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] How can a button be left bottom and stay there on window resize..
Qt 6.11 is out! See what's new in the release blog

[SOLVED] How can a button be left bottom and stay there on window resize..

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.3k 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    So for now i have 4 buttons in a buttonlayout but i want 1 of the 4 buttons to be always left bottom not always right bottom...

    @ buttonsLayout = new QHBoxLayout;
    buttonsLayout->addStretch();
    buttonsLayout->addWidget(ui->help);
    buttonsLayout->addWidget(ui->cancel);
    buttonsLayout->addWidget(ui->test);
    buttonsLayout->addWidget(ui->apply);
    mainLayout = new QVBoxLayout;
    mainLayout->addWidget(optionsGroupBox);
    mainLayout->addLayout(buttonsLayout);
    setLayout(mainLayout);@

    Maybe you understand what i want with this screenshot:
    !http://i.imgur.com/QcFaf.png(image)!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      guziemic
      wrote on last edited by
      #2

      Hi,

      Did you try to put Horizontal spacer between Help and Cancel buttons?

      BR,

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sam
        wrote on last edited by
        #3

        You need to addStretch() between Help and Cancel Button.

        @buttonsLayout = new QHBoxLayout;
        buttonsLayout->addWidget(ui->help);
        buttonsLayout->addStretch();
        buttonsLayout->addWidget(ui->cancel);
        buttonsLayout->addWidget(ui->test);
        buttonsLayout->addWidget(ui->apply);@

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leon
          wrote on last edited by
          #4

          Ok i founded how to do it!

          Previous

          @buttonsLayout = new QHBoxLayout;
          buttonsLayout->addStretch();
          buttonsLayout->addWidget(ui->help);
          buttonsLayout->addWidget(ui->cancel);
          buttonsLayout->addWidget(ui->test);
          buttonsLayout->addWidget(ui->apply);
          mainLayout = new QVBoxLayout;@
          

          Solution

          @buttonsLayout = new QHBoxLayout;
          buttonsLayout->addWidget(ui->help);
          buttonsLayout->addStretch();
          buttonsLayout->addWidget(ui->cancel);
          buttonsLayout->addWidget(ui->test);
          buttonsLayout->addWidget(ui->apply);@
          
          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            [quote author="Sam" date="1344941613"]You need to addStretch() between Help and Cancel Button.

            @buttonsLayout = new QHBoxLayout;
            buttonsLayout->addWidget(ui->help);
            buttonsLayout->addStretch();
            buttonsLayout->addWidget(ui->cancel);
            buttonsLayout->addWidget(ui->test);
            buttonsLayout->addWidget(ui->apply);@[/quote]

            You caught me!

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sam
              wrote on last edited by
              #6

              Yeah I did :)

              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