Results 1 to 7 of 7

Thread: custom signals vs newbie

  1. #1
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Red face custom signals vs newbie

    A question that shall be answered in two past half seconds:
    compiler complains that "variable or field 'result' declared void"
    and the code to which refers is this:
    Qt Code:
    1. class frmmanager: public QWidget
    2. {
    3. [...]
    4. signals:
    5. void result(EViewport win, int id); //<--this line
    6. };
    To copy to clipboard, switch view to plain text mode 
    here must be a noobie mistake...
    a tiny peluche bear to the first who answers
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

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

    Default Re: custom signals vs newbie

    Check that all the brackets and braces are closed properly. Could we see the part you have cut out?

  3. #3
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: custom signals vs newbie

    To avoid any misunderstanding, here is the entire .h:
    Qt Code:
    1. #ifndef MANAGER_H
    2. #define MANAGER_H
    3.  
    4. #include <QtGui>
    5. #include <QString>
    6. #include "ui_manager.h"
    7. #include "CTableWidgetItem.h"
    8. #include "viewports.h"
    9.  
    10. class frmmanager:public QWidget
    11. {
    12. Q_OBJECT
    13.  
    14. private:
    15. CViewports *viewport;
    16. QString vTable;
    17. int vWindow;
    18. bool vName;
    19.  
    20. private slots:
    21. void updateTable();
    22. void close();
    23. void takeId(int row,int col);
    24. void curTakeId();
    25. void parseChecks();
    26. void addentry();
    27. void lightReturn();
    28.  
    29. void pick();
    30. void pick1();
    31. void pick2();
    32. void pick3();
    33. void pick4();
    34. void pick5();
    35. void pick6();
    36. void pick7();
    37. void pick8();
    38. void pick9();
    39. void pick10();
    40.  
    41. protected:
    42. void initWidgetGeometry();
    43. void closeEvent(QCloseEvent *event);
    44. void setupTable();
    45. void connectActions();
    46. void populateTable(QSqlQuery *query,int n);
    47. void darkReturn();
    48. QString sanitize(QString str);
    49.  
    50. public:
    51. frmmanager();
    52. ~frmmanager();
    53. void setViewport(CViewports *view);
    54. Ui::frmmanager ui;
    55.  
    56. void load(QString name, int win, bool name=false);
    57.  
    58. signals:
    59. void result(EViewport win,int id); // the line is this
    60. };
    61.  
    62. #endif // MANAGER_H
    To copy to clipboard, switch view to plain text mode 
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

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

    Default Re: custom signals vs newbie

    What is the last line of viewports.h?

  5. #5
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: custom signals vs newbie

    Quote Originally Posted by wysota View Post
    What is the last line of viewports.h?
    Uhm... sorry I miss your goal, what do you mean?
    Trying to guess, I post the last lines of viewports.h
    Qt Code:
    1. class CViewports: public QObject
    2. {
    3. [...]
    4. public:
    5. [...]
    6. frmarticle* Article();
    7. frmviewarticles* ViewArticles();
    8. frmmanager* Manager();
    9. frmcontacts* Contacts();
    10. frmcontact* Contact();
    11. frmsizes* Sizes();
    12. frmsize* Size();
    13. frmtrends* Trends();
    14. frmtrend* Trend();
    15. frmums* Ums();
    16. frmum* Um();
    17. frmgms* Gms();
    18. frmgm* Gm();
    19. };
    20.  
    21. #endif // VIEWPORTS_H_INCLUDED
    To copy to clipboard, switch view to plain text mode 
    If you can be more precise, I'll show all you need.
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

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

    Default Re: custom signals vs newbie

    I'll try to explain what the problem is and maybe you'll find a solution yourself without showing us all the code

    The compiler thinks void result(...) is a declaration of a variable and not a function. It might be because there is something wrong with "EViewport" or because the compiler is confused by some earlier error (that's why I asked about viewports.h). You can try removing the signals: keyword and check if the problem persists.

  7. The following user says thank you to wysota for this useful post:

    Raccoon29 (21st April 2008)

  8. #7
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: custom signals vs newbie

    Ok, fixed, just for change you were right again

    No, signals: cut out made no difference.
    The problem was that in viewports.h I included manager.h (the error file), but the definition of EViewport came after the manager inclusion, so:
    Qt Code:
    1. // viewports.h
    2. #include "manager.h" // manager.h still doesn't know EViewport, so raises error
    3. enum EViewport{
    4. [...]
    5. }
    To copy to clipboard, switch view to plain text mode 

    PS: the tiny peluche bear will be delivered at your home, just leave your address to the operator
    Thanks again.
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

Similar Threads

  1. Custom signals?
    By godot in forum Newbie
    Replies: 7
    Last Post: 14th January 2008, 19:13

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.