Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Validating a multiple checkboes
QtWS25 Last Chance

Validating a multiple checkboes

Scheduled Pinned Locked Moved Mobile and Embedded
qcheckbox
3 Posts 3 Posters 1.4k Views
  • 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.
  • R Offline
    R Offline
    Rohith
    wrote on 9 Sept 2015, 06:48 last edited by
    #1

    Hi,
    I am new programmer in Qt and i am using Qt-4.7.4 to do my programming,i have created around 32 check boxes by using Qt-Creator and when ever an check box is selected i am changing the color of the check box by using the setStyleSheet to green method and clearing the tick mark of the check box.If the user again tries to select the checkbox that was in green color then i should warn him that the checkbox was already selected.To do this instead of checking all the check boxes individually i am trying to iterate them in a loop but i am unsuccessful to do by using a loop.I have changed the names of check box in the following way
    for FIRST CheckBox name is ch_1 and for second CheckBox name is ch_2 till ch_32.
    How should store these 32 objects of the checkboxes into an list or an vector.Please explain me with a sample code.
    Please guide me
    Thanks in advance,
    Rohith.G

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 9 Sept 2015, 07:09 last edited by
      #2

      There is no need to check all check boxes if one of them is clicked.
      Just connect the clicked(bool checked = false) signal to a slot.
      In that slot you get the pointer to the clicked check box using sender().

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nnnnn
        wrote on 9 Sept 2015, 14:03 last edited by
        #3

        I am not really sure what you want to do, but maybe a QButtonGroup could be helpful?

        1 Reply Last reply
        0

        2/3

        9 Sept 2015, 07:09

        • Login

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