Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Can't set popup x, y before showing
Forum Updated to NodeBB v4.3 + New Features

Can't set popup x, y before showing

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 168 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.
  • B Offline
    B Offline
    Bob64
    wrote on last edited by
    #1

    I have a menu item from which I am opening a popup with a known id. I am wanting to incorporate some logic to adjust the popup position. In in my menu item handler, if I print the popup's x and y, they are both 0. If I assign nonzero values to both x and y in the same handler and print again, they are still both zero. In other code, I have previously been able to set popup coordinates before opening. Does anyone have any idea what might be going on?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bob64
      wrote on last edited by
      #2

      Hmmm. I have reproduced this now in a small test app. It looks like the values I set x and y to are in fact respected when the popup is shown but any attempt to examine the values will show them as zero. They are still zero in an onAboutToShow handler I added to the popup, but show the expected values in an onOpened handler.

      I guess this means that care must be taken to avoid code like this:

          popup.y = yUsual; // the 'usual' y value
          var yDelta = calculateAdjustment(); // adjustment if needed
          popup.y += yDelta;
      

      since presumably this will leave popup.y at yDelta rather than yUsual+ yDelta.

      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