Results 1 to 7 of 7

Thread: Slots connection !

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Slots connection !

    Hi all ! I'm having some troubles with connecting a comboBox and a function...

    in .h
    Qt Code:
    1. private slots:
    2. /*! Call a quit function. */
    3. void slotQuit();
    4.  
    5. /*! Call a function which can show an AboutForm. */
    6. void slotAbout();
    7.  
    8. /*! Call a function which update the view when the comboBox is changed. */
    9. void slotCurrentSelectionChanged();
    To copy to clipboard, switch view to plain text mode 

    in .cpp
    Qt Code:
    1. ui_murefImpl::ui_murefImpl(QWidget *parent) : QMainWindow(parent)
    2. {
    3. // configuring the GUI
    4. ui.setupUi(this);
    5. // do connections
    6. connect(ui.actionQuit, SIGNAL(activated()), this, SLOT(slotQuit()));
    7. connect(ui.actionAbout, SIGNAL(activated()), this, SLOT(slotAbout()));
    8. connect(ui.comboBox, SIGNAL(activated(QString test)), this, SLOT(slotCurrentSelectionChanged()));
    9. // end
    10. }
    11.  
    12. // some code here...
    13.  
    14. void ui_murefImpl::slotCurrentSelectionChanged()
    15. {
    16. QMessageBox::information(0, "", "ok");
    17. CLinkGUI::callCurrentSelectionChanged();
    18. }
    To copy to clipboard, switch view to plain text mode 

    By default I put 2 items in the comboBox... so that I can select them but I never saw the message box with ok...

    (of course, the code compile fine... AND others slots function...)

    Thanks a lot for the one who find out the solution .

    edit: Oh, yeah, of course too, with the Designer I can add lower() function as a slot and it work perfectly...

    Qt Code:
    1. QObject::connect(comboBox, SIGNAL(activated(QString)), MainWindow, SLOT(lower()));
    To copy to clipboard, switch view to plain text mode 

    this line is added in ui_muref.h (generated from uic/moc tools)
    Last edited by agent007se; 18th July 2006 at 22:41.

Similar Threads

  1. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28
  2. How do I keep the client connection open ?
    By probine in forum Newbie
    Replies: 2
    Last Post: 25th March 2006, 19:06
  3. howto debug connection of signals and slots?
    By jh in forum Qt Programming
    Replies: 11
    Last Post: 24th February 2006, 09:30
  4. Missing slots
    By Mariane in forum Newbie
    Replies: 1
    Last Post: 5th February 2006, 01:50
  5. [QT4] threads, signals, and slots, please help.
    By ucntcme in forum Qt Programming
    Replies: 12
    Last Post: 25th January 2006, 14:23

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.