Results 1 to 4 of 4

Thread: Move toplevelwidget over border of multiscreen desktop

  1. #1
    Join Date
    Aug 2010
    Posts
    12
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Move toplevelwidget over border of multiscreen desktop

    Hi folks,

    hope somebody can guide me...

    In my application i have a QMainWindow with a central widget. Now what i want is to place a parentless (toplevel) QWidget over the existing central widget which acts like an event-proxy. That's no problem as it is not difficult.

    The problem comes up when using the application within a multiscreen desktop environment. When the application overlaps a screen so that parts of the mainwindow are drawn on another screen, the correct placement of the event-proxy-widget fails, although i move the event-proxy-widget in global coordinates.

    How can i freely move a widget within multiple screens, including the case where the widget overlaps screen-borders?

    Thanks in advance
    olzzen

  2. #2
    Join Date
    Aug 2010
    Posts
    12
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Cool Re: Move toplevelwidget over border of multiscreen desktop

    Just to share the solution for the described problem...

    I don't know if its a Qt or X11 bug but the solution is to show the widget before moving

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Move toplevelwidget over border of multiscreen desktop

    It's not a bug, it's a feature

    Qt widgets and their contents do not have correct geometry until their showEvent() occurs. So, in the constructor as well as in the resizeEvent() calls that occur prior to the showEvent(), any calls to methods that retrieve geometry (sizes, positions, etc.) will typically not return correct results.

    Qt's layout engine may generate resizeEvents() prior to a showEvent() as it calculates sizes and positions for the contents of the widgets it is laying out. This isn't a bug, it is by design. The way you avoid errors based on incorrect geometry is to ensure that you don't do anything until QWidget::isVisible() returns true.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. #4
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Move toplevelwidget over border of multiscreen desktop

    Hi, you could use event filtering with a QObject QObject::installEventFilter instead of your proxy widget. That way you don't have to care about coordinates of a widget and you can access all the events of the central widget.

    Ginsengelf

Similar Threads

  1. how to switch mouse control between multiscreen applications
    By bobythomas in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 12th August 2013, 17:29
  2. Replies: 0
    Last Post: 26th April 2011, 13:32
  3. Replies: 1
    Last Post: 15th April 2011, 06:12
  4. Move Window beyond screen border
    By the_flow in forum Qt Programming
    Replies: 2
    Last Post: 11th June 2010, 11:39
  5. Replies: 4
    Last Post: 19th February 2009, 17: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.