Results 1 to 4 of 4

Thread: How make QLabel always on top ?

  1. #1
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How make QLabel always on top ?

    I create a window with some widgets in a layout and there is a QLabel in a fixed position from right-bottom, while I create other widgets replacing old ones and put them into the old layout , which means the QLabel is created before the new widgets. Then the QLabel is shadowed by others. How could I set the QLabel on top all the way . I've tried setWindowFlags(Qt::WindowStaysOnTopHint), but it doesn't work.
    Any suggestions?

  2. #2
    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 make QLabel always on top ?

    If you don't want the content of the layout on top of the label then put the label in the layout. If there is a real reason you cannot do that then you probably want to call QWidget::raise() after fiddling with the layout.

  3. #3
    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 make QLabel always on top ?

    What could also work is to have a container for the dynamically created widgets and have the label as a sibling of the container.

    Cheers,
    _

  4. #4
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How make QLabel always on top ?

    oh, thanks a lot . QWidget::raise() is ok.

Similar Threads

  1. Make image bigger, when the mouse is over QLabel
    By Globulus in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2011, 09:39
  2. Replies: 1
    Last Post: 15th December 2010, 13:20
  3. How to make QTextEdit to look like QLabel?
    By pielas in forum Qt Programming
    Replies: 17
    Last Post: 8th April 2010, 15:36
  4. Replies: 1
    Last Post: 29th September 2009, 19:44
  5. Replies: 13
    Last Post: 18th February 2008, 00:20

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.