Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What determines initial position *on screen* of a widget?

What determines initial position *on screen* of a widget?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 669 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drmhkelley
    wrote on last edited by
    #1

    Sorry if I overlooked any prior answers to this question.

    I have an app with significant number of widgets with a rather complex tree of heritages relative to each other and the main app. Quite often, I need to post an informational message or query for input - this is generally done with a QMessageBox. I haven't figured out how to control the position on screen of where the QMessageBox appears. Ideally, it would be co-located with whatever widget posts it. At present, the QMessageBox seems to appear in locations that have nothing to do with what's going on in the app.

    I know how to ask for the position of any widget, but only relative to its parent widget. I know how to set the position of the QMessageBox, but only an absolute position on screen. From what I've figured out so far, I could figure this out by working back through the widget tree and keeping track of each widget relative to its parent, until I finally bump into a main application widget, at which time I could calculate where on screen to pop up the widget.

    Surely there's a smarter way than that. What have I missed?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      mapToGlobal()
      seems what you looking for.

      1 Reply Last reply
      1
      • D Offline
        D Offline
        drmhkelley
        wrote on last edited by
        #3

        Perfect - worked like a charm!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved