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. How to check the number of pushbuttons in one by one whether its enable or not
Forum Update on Monday, May 27th 2025

How to check the number of pushbuttons in one by one whether its enable or not

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 247 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.
  • SURYA PS Offline
    SURYA PS Offline
    SURYA P
    wrote on last edited by SURYA P
    #1

    Is it possible to check number of pushbuttons in one by one ..
    i thought that if we set the pushbutton name as a integer value means ,
    int num = 0
    pushbutton=1;
    pushbutton_1=2;
    pushbutton_2=3;

    like wise we changed this as a integer ,i can create code like this

    for(int num=0;num<=i;num++)
    {
    //stuffs  
    }
    

    this idea is works ? ... give me some suggestion for this topic

    JonBJ Pl45m4P 2 Replies Last reply
    0
    • SURYA PS SURYA P

      Is it possible to check number of pushbuttons in one by one ..
      i thought that if we set the pushbutton name as a integer value means ,
      int num = 0
      pushbutton=1;
      pushbutton_1=2;
      pushbutton_2=3;

      like wise we changed this as a integer ,i can create code like this

      for(int num=0;num<=i;num++)
      {
      //stuffs  
      }
      

      this idea is works ? ... give me some suggestion for this topic

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @SURYA-P
      Sounds like you want an array/list of (pointers to) your pushbuttons, so you can iterate over them?

      QList<QPushButton*> buttons;
      for (int i = 0; i < 3; i++)
      {
          buttons.append(new QPushButton);
          buttons[i].setText(QString::number(i));
      }
      
      1 Reply Last reply
      5
      • SURYA PS SURYA P

        Is it possible to check number of pushbuttons in one by one ..
        i thought that if we set the pushbutton name as a integer value means ,
        int num = 0
        pushbutton=1;
        pushbutton_1=2;
        pushbutton_2=3;

        like wise we changed this as a integer ,i can create code like this

        for(int num=0;num<=i;num++)
        {
        //stuffs  
        }
        

        this idea is works ? ... give me some suggestion for this topic

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #3

        @SURYA-P

        QButtonGroup (https://doc.qt.io/qt-5/qbuttongroup.html)


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        4

        • Login

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