Results 1 to 4 of 4

Thread: centralWidget always in center

  1. #1
    Join Date
    Sep 2009
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default centralWidget always in center

    Can somebody tell me how I can position the centralwidget in the center of the mainwindow. I have a QTextEdit as a centralWidget and I want it always to be in the middle of the window.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: centralWidget always in center

    You probably forgot to apply a layout to your central widget (which is probably the parent of the text edit).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2009
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: centralWidget always in center

    Can you tell me how many layout objects I need, since I want the central widget(size of a A4 or Letter) always to be placed in the center of the main window and thus nothing on the left or right. Should I add a layout to the central widget and then three other widgets (left, middle, right) with three seperate layouts coupled to them? or is one central widget layout enough.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: centralWidget always in center

    Quote Originally Posted by xyfix View Post
    Can you tell me how many layout objects I need
    Just one...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTableView checkbox center with stylesheet
    By quiet in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2011, 14:52
  2. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 08:06
  3. Replies: 1
    Last Post: 21st November 2009, 21:38
  4. how to put a dialog in the center of the screen
    By biswajithit in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2008, 13:24
  5. centralWidget and QDockWidgets in designer
    By momesana in forum Qt Tools
    Replies: 1
    Last Post: 18th December 2006, 12:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.