[Qt-interest] Is it okay to put a QRect (geometry) into a QVariant?
Niels Dekker - no return address
noreply at this.is.invalid
Tue Feb 3 21:44:47 CET 2009
>> My program basically does settings.setValue("geometry",geometry()), to
>> store the geometry of a window into the Windows registry. Is that okay?
Robert Hairgrove wrote:
> According to the docs, it is "best practice" to do a QWidget::resize()
> and then QWidget::move() instead of setGeometry(). This is mostly due to
> some issues with the X11 window manager, I believe. On Windows, it
> might not matter because there is a nice API function which takes a
> rectangle as argument (Get/SetWindowPosition).
Thank you, Robert. So I'm lucky because I'm working on a Windows app.
> At any rate, you might want to consider storing these coordinates
> (position and size) separately as QSize and QPoint which pose no
> problems for QVariant (and for QSettings).
Yes, they do, unfortunately! QSize and QPoint cannot be put into a
QVariant either, when QT_NO_GEOM_VARIANT is defined.
> As a last resort, it is always possible to store, and later
> read, four separate integer values
> from a QSettings object.
For the time being I'll assume that nobody defines QT_NO_GEOM_VARIANT,
when they're using my application. So that I can safely put a QRect
value into a QSettings object...
Kind regards, Niels
More information about the Qt-interest-old
mailing list