[Solved] QComboBox Questions



  • Hello,

    I have two questions:

    1. Is there a simple method to clear multiple QComboBox objects at once? I know how I can clear one using .clear() to clear the information in one object at a time.

    2. Is there a simple method to copy the contents of one QComboBox to another, or multiple?

    I know the long way of populating or clearing each QComboBox individually and I am wondering if there is a quicker solution.

    Thanks in advance.


  • Lifetime Qt Champion

    Hi,

    1. Search for QComboBoxes using findChildren and loop over the returned list calling clear on each of them.

    2. Create a QStringList from the content of the reference QComboBox and set it on the others using addItems (you can re-use the QComboBox list from 1)

    Hope it helps



  • Thank you SGaist!


  • Lifetime Qt Champion

    You're welcome !

    If this answers your question, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.