Results 1 to 2 of 2

Thread: QWidget::pos Appears Unreliable

  1. #1
    Join Date
    Sep 2008
    Location
    St. Louis, MO
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QWidget::pos Appears Unreliable

    Are there known problems calling QWidget's pos() function from closeEvent? I have an application running under Linux/X11 that uses QSettings to persist the size and location of QWidgets. As recommended in the Qt docs, I read the settings in the constructor and write them in the widget's closeEvent function. The behavior I see is that the position written to the settings files is often (though not always) incorrect. Could it be that QWidget's pos() function cannot be counted on when called from closeEvent?
    Last edited by mbrusati; 25th February 2009 at 00:17. Reason: Unwanted smiles ended up in my text.

  2. #2
    Join Date
    Sep 2008
    Location
    St. Louis, MO
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWidget::pos Appears Unreliable

    I've discovered something new since my original post. I record the position and size of a QDialog in overridden moveEvent and resizeEvent functions. When I close the dialog I record position and size using QSettings. What I'm seeing is this: Occassionally I will get a moveEvent that reports the position incorrectly, and the bogus move event seems to always occur after a show event. For example, if I print the position of the dialog from showEvent it may correctly report the position to be (500, 600). But sometimes a move event will follow the show event and it will incorrectly report the position, e.g. (0, 0). This is occurring under Linux/X11. Has anyone else seen such behavior?

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.