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. Setting QColorDialog position: QColorDialog::move(int x, int y) does not seem to work
Forum Updated to NodeBB v4.3 + New Features

Setting QColorDialog position: QColorDialog::move(int x, int y) does not seem to work

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.0k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    neduard
    wrote on last edited by
    #1

    Hello, I create a QColorDialog that is not modal in a custom QDialog (it's parent) and then pass it to a custom QObject (a controller).
    The controller is in charge of a number of things such as setting the currentColor, but it also has the function of showing the colorDialog when the user needs to pick a color (for my implementation, I need a single QColorDialog to handle all color choosing).

    The problem is that after the user "closes" the dialog, by clicking "OK" or "Cancel", a subsequent call of colorDialog->show() will result in the dialog being shown directly in front of the QDialog. Since the user needs to interact both with the QDialog and with the colorDialog, it has to keep dragging it to be able to see what's underneath it.

    Calling colorDialog->move(int x, int y) either in it's parent (the QDialog) or the controller does not seem to affect it's position. Curiously, colorDialog->pos() does show the updated position according to move(). But the ColorDialog is still always displayed in front of the regular QDialog.

    Is there any way for me to move the position of the QColorDialog from code?

    Regards,
    Eduard Nicodei

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

      Hi Eduard.
      you have to map the position to the parent of your QDialog.
      A better approach would be that QDialog and ColorDialog would have the same parent.

      Checkout the manual for mapToParent() or mapToGlobal()

      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