Bump version of QWidget geometry serialization to 2.0

It was decided not to port the handling of the saved
screen size to Qt 4.8, so, bump the major version to
ensure Qt 4.8 bails out.

Task-number: QTBUG-38858
Change-Id: Ia870519553172cd383830d9a722b0fada180ee1b
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
bb10
Friedemann Kleint 2014-09-04 15:14:06 +02:00
parent f721a85b1e
commit 50e1733dfa
1 changed files with 6 additions and 6 deletions

View File

@ -7213,9 +7213,9 @@ QByteArray QWidget::saveGeometry() const
const quint32 magicNumber = 0x1D9D0CB;
// Version history:
// - Qt 4.2 - 4.8.6, 5.0 - 5.3 : Version 1.0
// - Qt 4.8.6 - today, 5.4 - today: Version 1.1, save screen width in addition to check for high DPI scaling.
quint16 majorVersion = 1;
quint16 minorVersion = 1;
// - Qt 4.8.6 - today, 5.4 - today: Version 2.0, save screen width in addition to check for high DPI scaling.
quint16 majorVersion = 2;
quint16 minorVersion = 0;
const int screenNumber = QApplication::desktop()->screenNumber(this);
stream << magicNumber
<< majorVersion
@ -7270,13 +7270,13 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
if (storedMagicNumber != magicNumber)
return false;
const quint16 currentMajorVersion = 1;
const quint16 currentMajorVersion = 2;
quint16 majorVersion = 0;
quint16 minorVersion = 0;
stream >> majorVersion >> minorVersion;
if (majorVersion != currentMajorVersion)
if (majorVersion > currentMajorVersion)
return false;
// (Allow all minor versions.)
@ -7293,7 +7293,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
>> maximized
>> fullScreen;
if (majorVersion > 1 || minorVersion >= 1)
if (majorVersion > 1)
stream >> restoredScreenWidth;
const QDesktopWidget * const desktop = QApplication::desktop();