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 align pushbutton
Qt 6.11 is out! See what's new in the release blog

How to align pushbutton

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 9.0k 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.
  • A Offline
    A Offline
    andyc
    wrote on last edited by
    #1

    Hello, how i can i allign my pushbutton in the centre of the mainwindow ? ive been googling for a while, and didnt find any answer...
    also, i would like to have my button in the centre of the window even if the window is resized...

    Best regards,
    OSiRiS

    1 Reply Last reply
    0
    • R Offline
      R Offline
      RazrFalcon
      wrote on last edited by
      #2

      Add QPushButton to main widget in designer and press Ctrl+G.
      It's the simplest way.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andyc
        wrote on last edited by
        #3

        Sorry, this does not solve anything

        it just stretches the button, so its as wide as mainwindow, and the button“s geometry is disabled, so i cant move it any further

        1 Reply Last reply
        0
        • R Offline
          R Offline
          RazrFalcon
          wrote on last edited by
          #4

          But now it's...
          [quote author="andyc" date="1319583136"]in the centre of the window even if the window is resized[/quote]
          also, you can set "Horizontal Policy" property to "Fixed"

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cincirin
            wrote on last edited by
            #5

            See "How to center a window on the screen":http://developer.qt.nokia.com/wiki/Center_a_Window_on_the_Screen
            But instead of desktop available geometry, use button parent geometry.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dangelog
              wrote on last edited by
              #6

              [quote author="andyc" date="1319583136"]Hello, how i can i allign my pushbutton in the centre of the mainwindow ? ive been googling for a while, and didnt find any answer...
              also, i would like to have my button in the centre of the window even if the window is resized...

              Best regards,
              OSiRiS[/quote]

              Do you mean like using a layout? Otherwise, can you elaborate?

              Software Engineer
              KDAB (UK) Ltd., a KDAB Group company

              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