Results 1 to 8 of 8

Thread: QStringList make to be born typedef QStringList

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QStringList make to be born typedef QStringList

    Today I have uncovered that QStringList do not have type and is not
    possibel to return

    Qt Code:
    1. QStringList Href_Gui::GetUserConfig();
    2. {
    3. return this->hrefconfisuser;
    4. }
    To copy to clipboard, switch view to plain text mode 

    And to solved this i make ...
    Qt Code:
    1. typedef QMap<int, QStringList> Userconf;
    2.  
    3. Userconf res;
    4. res.insert(0,MyOwnQStringList);
    5. if moore .... res.insert(1,MyOwnQStringList);
    6.  
    7. Userconf res = function();
    8.  
    9. resultMap::Iterator it;
    10. for ( it = res.begin(); it != res.end(); ++it ) {
    11. QStringList fullrow = it.value();
    12. }
    To copy to clipboard, switch view to plain text mode 

    My question how to set a typedef QStringList
    and not waste performance? .

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,365
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QStringList make to be born typedef QStringList

    Quote Originally Posted by patrik08
    Today I have uncovered that QStringList do not have type
    Could you explain that? QStringList is a QList<QString>.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QStringList make to be born typedef QStringList

    Quote Originally Posted by patrik08
    Today I have uncovered that QStringList do not have type and is not
    possibel to return

    Qt Code:
    1. QStringList Href_Gui::GetUserConfig();
    2. {
    3. return this->hrefconfisuser;
    4. }
    To copy to clipboard, switch view to plain text mode 
    Many Qt classes have methods that return QStringList without problems. What makes you think that you can't return QStringList?

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStringList make to be born typedef QStringList

    MINGW say...

    \href_gui.cpp:46: error: declaration of `QStringList Href_Gui::GetUserC
    onfig()' outside of class is not definition



    Qt Code:
    1. QStringList Href_Gui::GetUserConfig();
    2. {
    3. return this->hrefconfisuser;
    4. }
    To copy to clipboard, switch view to plain text mode 

    i must transform so QStringList > QList??

    Qt Code:
    1. QList Href_Gui::GetUserConfig();
    2. {
    3. return this->hrefconfisuser;
    4. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStringList make to be born typedef QStringList

    Qt Code:
    1. #include <QPointer>
    2. #include <QStringList>
    3.  
    4. /* typedef QMap<int, QStringList> Userconf; emergency solucion */
    5.  
    6. class Href_Gui : public QDialog, public Ui::Href_Gui
    7. {
    8. Q_OBJECT
    9. //
    10. public:
    11. static Href_Gui* self( QWidget* = 0 );
    12. Userconf GetUserConfig();
    13. //
    14. protected:
    15. void closeEvent( QCloseEvent* );
    16. //
    17. private:
    18. Href_Gui( QWidget* = 0 );
    19. static QPointer<Href_Gui> _self;
    20. QStringList hrefconfisuser;
    21.  
    22. //
    23. public slots:
    24. void Acceptvars();
    25.  
    26. };
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QStringList make to be born typedef QStringList

    Quote Originally Posted by patrik08
    href_gui.cpp:46: error: declaration of `QStringList Href_Gui::GetUserConfig()' outside of class is not definition
    The problem is not with QStringList but with GetUserConfig() method which wasn't declared in class definition.

    Change:
    Qt Code:
    1. class Href_Gui : public QDialog, public Ui::Href_Gui
    2. {
    3. ...
    4. public:
    5. ...
    6. Userconf GetUserConfig();
    7. ...
    8. };
    To copy to clipboard, switch view to plain text mode 
    to
    Qt Code:
    1. class Href_Gui : public QDialog, public Ui::Href_Gui
    2. {
    3. ...
    4. public:
    5. ...
    6. QStringList GetUserConfig();
    7. ...
    8. };
    To copy to clipboard, switch view to plain text mode 
    and it should work.

  7. #7
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStringList make to be born typedef QStringList

    html_edit\href_gui.cpp:41: error: declaration of `QStringList Href_Gui::GetUserC
    onfig()' outside of class is not definition
    html_edit\href_gui.cpp:42: error: expected unqualified-id before '{' token
    html_edit\href_gui.cpp:42: error: expected `,' or `;' before '{' token
    mingw32-make[1]: *** [build\.o\win32\href_gui.o] Error 1
    mingw32-make[1]: Leaving directory `C:/_current/html_editor'
    mingw32-make: *** [release] Error 2

    QStringList is not a type! i suppose...


    ***.h
    Qt Code:
    1. #ifndef HREF_GUI_H
    2. #define HREF_GUI_H
    3. #include <QStringList>
    4. #include <QActionGroup>
    5. #include <QColorDialog>
    6. #include <QPrinter>
    7. #include <QPrintDialog>
    8. #include <QFileDialog>
    9. #include <QFile>
    10. #include <QTextStream>
    11. #include <QMessageBox>
    12. #include <QTextDocumentFragment>
    13. #include <QTextCursor>
    14. #include <QFileDialog>
    15. #include <QString>
    16. #include <QTextStream>
    17. #include <QFontDatabase>
    18. #include <QTextBlockFormat>
    19. #include <QTextListFormat>
    20. #include <QTextFormat>
    21. #include <QTextList>
    22. #include <QTextCodec>
    23. #include <QByteArray>
    24. #include "href_start.h"
    25. //
    26. /* Save file as href_gui.h */
    27. /* Class Href_Gui Created on Fri Jun 2 11:13:27 CEST 2006 */
    28. //
    29. #include <QPointer>
    30. #include <QStringList>
    31.  
    32. /* typedef QMap<int, QStringList> Userconf;*/
    33.  
    34. class Href_Gui : public QDialog, public Ui::Href_Gui
    35. {
    36. Q_OBJECT
    37. //
    38. public:
    39. static Href_Gui* self( QWidget* = 0 );
    40. QStringList GetUserConfig();
    41. //
    42. protected:
    43. void closeEvent( QCloseEvent* );
    44. //
    45. private:
    46. Href_Gui( QWidget* = 0 );
    47. static QPointer<Href_Gui> _self;
    48. QStringList hrefconfisuser;
    49.  
    50. //
    51. public slots:
    52. void Acceptvars();
    53.  
    54. };
    55. //
    56. #endif // HREF_GUI_H
    To copy to clipboard, switch view to plain text mode 
    ***.cpp
    Qt Code:
    1. #include "href_gui.h"
    2. //
    3. /* Save file as href_gui.cpp */
    4. /* Class Href_Gui Created on Fri Jun 2 11:13:28 CEST 2006 */
    5. //
    6. #include <QCloseEvent>
    7. //
    8. QPointer<Href_Gui> Href_Gui::_self = 0L;
    9. //
    10. Href_Gui* Href_Gui::self( QWidget* parent )
    11. {
    12. if ( !_self )
    13. _self = new Href_Gui( parent );
    14. return _self;
    15. }
    16. //
    17. Href_Gui::Href_Gui( QWidget* parent )
    18. : QDialog( parent )
    19. {
    20. setupUi( this );
    21. hrefconfisuser.clear();
    22. connect(okButton, SIGNAL(clicked()), this, SLOT(Acceptvars()));
    23. }
    24. //
    25.  
    26. void Href_Gui::Acceptvars()
    27. {
    28. QString te = text_href->text();
    29. QString url = url_href->text();
    30. QString target = target_href->itemText(target_href->currentIndex());
    31. if (te.size() < 1 or url.size() < 1) {
    32. QMessageBox::warning( this, tr( "Error Text!" ),tr("Mettete una url valida o un testo valido!"));
    33. }
    34. hrefconfisuser.clear();
    35. hrefconfisuser.append(te);
    36. hrefconfisuser.append(url);
    37. hrefconfisuser.append(target);
    38. accept();
    39. }
    40.  
    41. QStringList Href_Gui::GetUserConfig();
    42. {
    43. /* return QString(hrefconfisuser.join("$"));*/
    44. return hrefconfisuser;
    45. }
    46. void Href_Gui::closeEvent( QCloseEvent* e )
    47. {
    48. e->accept();
    49. }
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStringList make to be born typedef QStringList

    Sorry i not see ->

    #41 QStringList Href_Gui::GetUserConfig(); ";"

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.