Results 1 to 3 of 3

Thread: How to make popup window exactly cover application window?

  1. #1

    Default How to make popup window exactly cover application window?

    I have a popup window (with a transparent background). I want this window to be the same size as the primary application which calls it and be in the same position (so it covers the application window). Does anyone know how to do that?

    Also, if possible, do you know how to get the current position of the cursor relative to the window that just popped up?

    Here is how the process works:

    main window -> user clicks -> widget pops up that covers the parent application window completely -> mouse coordinates are used to draw on the transparent widget that covers application window

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to make popup window exactly cover application window?

    Quote Originally Posted by TheNewGuy View Post
    I have a popup window (with a transparent background). I want this window to be the same size as the primary application which calls it and be in the same position (so it covers the application window). Does anyone know how to do that?
    set this widget active using QApplication::setActiveWindow.

    Quote Originally Posted by TheNewGuy View Post
    Also, if possible, do you know how to get the current position of the cursor relative to the window that just popped up?

    Here is how the process works:

    main window -> user clicks -> widget pops up that covers the parent application window completely -> mouse coordinates are used to draw on the transparent widget that covers application window
    take a look at QCursor::pos, note: this method returns current global mouse coordinates, if you need to map coordinates to particular coordinate system you should use one of map-functions: QWidget::mapFromGlobal, QWidget::mapFromParent etc.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to make popup window exactly cover application window?

    I have a popup window (with a transparent background). I want this window to be the same size as the primary application which calls it and be in the same position (so it covers the application window). Does anyone know how to do that?
    setting the primary application as parent to popup dialog
    and
    resize(parent->size());
    will make the size of the window to parent size ..
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. QSkinWindows Classes
    By kernel_panic in forum Qt-based Software
    Replies: 45
    Last Post: 20th April 2010, 12:35
  2. How to make window semi modal
    By kaushal_gaurav in forum Qt Programming
    Replies: 7
    Last Post: 29th August 2008, 08:27
  3. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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.