Results 1 to 3 of 3

Thread: How to fix the position of a widget in the main window

  1. #1
    Join Date
    Jul 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to fix the position of a widget in the main window

    Hi,
    I want a widget to appear on a fixed position in my mainwindow when I push a button.
    How can I fix the position to the left side of my mainwindow without using the Designer ?

    Thanks for help !

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to fix the position of a widget in the main window

    Maybe using a QDockWindow and QMainWindow::addDockWidget with Qt::LeftDockWidgetArea?

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    ich (12th August 2014)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to fix the position of a widget in the main window

    Or inserting/removing the widget at position 0 in a QHBoxLayout that holds the remaining content of the main window.
    Or showing and absolutely positioning a widget (child of main window) on top of the content in the main window. Calling move(0,0) should get you most of the way.

    Really depends on the effect you are trying to achieve.
    Last edited by ChrisW67; 11th August 2014 at 21:05. Reason: updated contents

  5. The following user says thank you to ChrisW67 for this useful post:

    ich (12th August 2014)

Similar Threads

  1. WIdget relationship with Main Window
    By Robobulls in forum Newbie
    Replies: 4
    Last Post: 11th June 2013, 21:33
  2. Customizable widget over main window.
    By SeeLook in forum Qt Programming
    Replies: 5
    Last Post: 23rd June 2012, 16:24
  3. Replies: 2
    Last Post: 16th April 2012, 04:13
  4. Add a Frame Widget to the main window
    By kamlmish in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2010, 08:51
  5. Setting the starting position of Main Window
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2006, 12:17

Tags for this Thread

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.