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 add list of Qpushbuttons in gui application
Forum Updated to NodeBB v4.3 + New Features

how add list of Qpushbuttons in gui application

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 1.2k 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.
  • B Offline
    B Offline
    Bharth
    wrote on last edited by
    #1

    Hi,
    i want list of 3 pushbutton in a single row ,
    row must be more than one
    please give some suggestion

    1 Reply Last reply
    0
    • FlotisableF Offline
      FlotisableF Offline
      Flotisable
      wrote on last edited by
      #2

      I think you can use QHboxLayout and QVBoxLayout.

      1 Reply Last reply
      1
      • B Offline
        B Offline
        Bharth
        wrote on last edited by
        #3

        i want loop for example: pushbutton1,pushbutton2
        pushbutton1,pushbuuton2
        pushbutton1,pushbutton2

        1 Reply Last reply
        0
        • FlotisableF Offline
          FlotisableF Offline
          Flotisable
          wrote on last edited by
          #4

          You can loop for that, for example

          for( int i = 0 ; i < /*the row number you want*/ ; ++i )
          {
             // add a row of pushbuttons to a QHBoxLayout
             // add the QHBoxLayout to QVBoxLayout
          }
          

          Are all the pushbutton1 and pushbutton2 the same?

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bharth
            wrote on last edited by
            #5

            yes like audio call,video call button in every contact

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TobbY
              wrote on last edited by
              #6

              Hello,
              You can either add QPushButton through Qt creator designer or to add button horizontally from code.

              QHBoxLayout *_layout = new QHBoxLayout(); // You need Horizontal layout first
               ui->widget->setLayout(_layout); // Apply layout to parent widget
               QPushButton * p1 = new QPushButton();
               QPushButton * p2 = new QPushButton();
               _layout->addWidget(p1); // add buttons to layout
               _layout->addWidget(p2); 
              // And so on..
              ...
              
              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bharth
                wrote on last edited by
                #7

                i want same buttons in multiple times like loops
                i created widget with 3 buttons and i added that widget to qlistwidget,,,,,,i want same widget multiple times

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  TobbY
                  wrote on last edited by
                  #8

                  @Bharth said in how add list of Qpushbuttons in gui application:

                  qlistwidget

                  Hi,
                  Please look at this for adding custom widget to QListWidget .

                  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