Results 1 to 10 of 10

Thread: QComboBox popup

  1. #1
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QComboBox popup

    Dear all

    I have a QCombobox that brings its data from QSqlQueryModel,

    What I need to do is, everytime i requested for a pop up I need the combo clears its data and repeate QSqlQueryModel

  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: QComboBox popup

    Reimplement QComboBox::showPopup() and execute the model's query again there.

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QComboBox popup

    searching by forum still works QComboBox & database
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. #4
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox popup

    Dear all

    We could all ready use QSqlModel for the combo, and we dont have problem with it.

    But the problem is, we have a main window that has combos, which is updates from other widgets.

    What we would like to do is, everytime we request for a pop up, we need to delete the datas in the combo, and re SELECT from the database again, and fill the combo.

    We were not able to find a signal for that.

    Please help...

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QComboBox popup

    you can use the same model in comboboxes and in another views. so, if you change this model then all views will be updated automatically and comboboxes also. I don't see any problem
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #6
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox popup

    No the thing is,

    The model in the main page is change by the other widget, so we need to change it.

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QComboBox popup

    I don't understand the problem in this case.
    why you can't set that model to needed combobox?
    Qt Code:
    1. ...
    2. m_comboBox->setModel(m_mySqlModel);
    3. ...
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  8. #8
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox popup

    Dear Spirit

    We could set the model, but i could not find a signal for combo

    like connect(combo... clicked signal setxmodel)

    we need a connect like

    showpopup

    and then set model again...

  9. #9
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QComboBox popup

    so, you just need show popup, right?
    try to handle this signal QAbstractItemModel::dataChanged
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  10. #10
    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: QComboBox popup

    Quote Originally Posted by aekilic View Post
    What we would like to do is, everytime we request for a pop up, we need to delete the datas in the combo, and re SELECT from the database again, and fill the combo.
    Why don't you follow my suggestion?

    We were not able to find a signal for that.
    You can't do everything by using signals.

Similar Threads

  1. QDataWidgetMapper and QCombobox
    By miraks in forum Qt Programming
    Replies: 4
    Last Post: 6th December 2008, 18:53
  2. Make the QComboBox popup translucent or transparent ?
    By charlse in forum Qt Programming
    Replies: 5
    Last Post: 18th August 2008, 17:18
  3. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 20:25
  4. using QComboBox as an ItemView
    By EricTheFruitbat in forum Qt Programming
    Replies: 3
    Last Post: 24th January 2007, 17:14
  5. Can't close my popup
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2006, 10:10

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.