Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QComboBox Questions
Forum Updated to NodeBB v4.3 + New Features

[Solved] QComboBox Questions

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vito3223
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vito3223
        wrote on last edited by
        #3

        Thank you SGaist!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved