Results 1 to 5 of 5

Thread: slot issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Posts
    24
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default slot issue

    Hi guys,

    Could you tell me why the "about" messagebox doesn't trigger whe I'm doing this :


    Qt Code:
    1. class Main: public QMainWindow
    2. {
    3. //Q_OBJECT
    4.  
    5. public:
    6. Main();
    7.  
    8. public slots:
    9. void about();
    10.  
    11. private:
    12. QToolBar *m_tb;
    13. QMenu *m_settings;
    14. void createMenubar();
    15. };
    16.  
    17.  
    18. void Main::about()
    19. {
    20. QMessageBox::about( this, tr("About"), tr("test") );
    21. }
    22.  
    23.  
    24.  
    25. void Main::createMenubar()
    26. {
    27. QMenu *menu;
    28. QAction *atTop;
    29.  
    30. atTop = new QAction("Always on top", this);
    31. connect(atTop, SIGNAL(triggered()), this, SLOT(about()));
    32.  
    33. menu = menuBar()->addMenu(tr("&Settings"));
    34. menu->addAction(atTop);
    35. }
    36.  
    37.  
    38.  
    39. Main::Main(): QMainWindow()
    40. {
    41. createMenubar();
    42. }
    43.  
    44.  
    45.  
    46. int main(int argc, char *argv[])
    47. {
    48. QApplication a(argc, argv);
    49.  
    50. Main *w = new Main();
    51. w->show();
    52. return a.exec();
    53. }
    To copy to clipboard, switch view to plain text mode 


    I cannot find my fault

    Thanks for your help
    Last edited by wysota; 17th September 2010 at 18:10.

Similar Threads

  1. QFileDialog Signal / Class Slot issue
    By Wasabi in forum Newbie
    Replies: 5
    Last Post: 7th August 2010, 23:48
  2. QSlider slot trigger issue
    By depsch in forum Newbie
    Replies: 1
    Last Post: 18th September 2009, 05:25
  3. qt signal/slot auto-connect issue
    By parnedo in forum Qt Programming
    Replies: 9
    Last Post: 16th July 2009, 12:55
  4. Signal and Slot Issue
    By dlrlsqa1 in forum Newbie
    Replies: 5
    Last Post: 23rd March 2009, 12:44
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.