Results 1 to 1 of 1

Thread: Signal & Slots with ComboBox

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Question Signal & Slots with ComboBox

    Hello. I am new to Qt and I am trying to use signals and slots.

    I have a ComboBox which is part of my UI and has pre-filled values. When I change the value of the ComboBox I would like it to call a function.

    This is what I have tried to do (called in my QMainWindow class):

    Qt Code:
    1. QObject::connect(m_ui.cmbResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setGameWindowResolution()));
    To copy to clipboard, switch view to plain text mode 

    It's also worth mentioning that I tried to do this with a menu item which worked fine:
    Qt Code:
    1. QObject::connect(m_ui.actionAdd_Empty, &QAction::triggered, m_pSceneManager, &SceneManager::addEmptyGameObject);
    To copy to clipboard, switch view to plain text mode 

    Any help would be greatly appreciated, thanks.

    EDIT:
    Ok - finally got this working. I needed to put my function definition in 'public slots:'
    Last edited by Jack_Holmes; 15th December 2015 at 22:11.

Similar Threads

  1. comboBox signal question?
    By unix7777 in forum Newbie
    Replies: 7
    Last Post: 24th March 2010, 10:10
  2. Signal from a ComboBox cell in a QTableWidget
    By thebra in forum Qt Programming
    Replies: 5
    Last Post: 21st October 2008, 08:48
  3. emit the activated signal on a combobox
    By Equilibrium in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2007, 12:33
  4. signal and slots
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 16th October 2007, 08:31
  5. Replies: 2
    Last Post: 12th October 2006, 09:17

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.