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. there are some QCheckBox in 1 column, how to make the 2nd line QCheckBox Indent in order to make it look like the child of the 1st line one?
Qt 6.11 is out! See what's new in the release blog

there are some QCheckBox in 1 column, how to make the 2nd line QCheckBox Indent in order to make it look like the child of the 1st line one?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.9k Views 2 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    there are some QCheckBox in 1 column, how to make the 2nd line QCheckBox Indent in order to make it look like the child of the 1st line one?

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

      in what widget ? QColumnView ?
      How did you insert the first checkbox ?

      O 1 Reply Last reply
      0
      • mrjjM mrjj

        in what widget ? QColumnView ?
        How did you insert the first checkbox ?

        O Offline
        O Offline
        opengpu2
        wrote on last edited by opengpu2
        #3

        @mrjj just in QGroupBox, and the QGroupBox in QDialog...just use QVBoxLayout, addWidget

        mrjjM 1 Reply Last reply
        0
        • O opengpu2

          @mrjj just in QGroupBox, and the QGroupBox in QDialog...just use QVBoxLayout, addWidget

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @opengpu2
          Ahh, that way.

          You could insert a widget as placeholder for the checkbox and use setContentsMargins "indent" it as you desire.

              QWidget * w = new QWidget();
              w->setLayout ( new QVBoxLayout() );
              QCheckBox *chk = new QCheckBox ( "abcd" );
              w->layout()->addWidget ( chk );
              w->layout()->setContentsMargins(20,9,9,9);
              ui->groupBox->layout()->addWidget ( w );
          
          O 1 Reply Last reply
          0
          • mrjjM mrjj

            @opengpu2
            Ahh, that way.

            You could insert a widget as placeholder for the checkbox and use setContentsMargins "indent" it as you desire.

                QWidget * w = new QWidget();
                w->setLayout ( new QVBoxLayout() );
                QCheckBox *chk = new QCheckBox ( "abcd" );
                w->layout()->addWidget ( chk );
                w->layout()->setContentsMargins(20,9,9,9);
                ui->groupBox->layout()->addWidget ( w );
            
            O Offline
            O Offline
            opengpu2
            wrote on last edited by
            #5

            @mrjj thank you very much

            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