summaryrefslogtreecommitdiffstats
path: root/tools/designer
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-22 12:19:48 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-22 12:19:48 (GMT)
commitca7be48b7a150952a9657d1000941fb986e5bb2b (patch)
tree2210513bf2f8063a6064e994d63458d4cca1229d /tools/designer
parente6dc532b7061df210f350e9f6cb8ab85e25d7896 (diff)
parent2525432106823ff3df7f6bb2d44c0a376356a1a8 (diff)
downloadQt-ca7be48b7a150952a9657d1000941fb986e5bb2b.zip
Qt-ca7be48b7a150952a9657d1000941fb986e5bb2b.tar.gz
Qt-ca7be48b7a150952a9657d1000941fb986e5bb2b.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-tools-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-tools-staging: Designer: Check for 0-spacing when loading grid settings.
Diffstat (limited to 'tools/designer')
-rw-r--r--tools/designer/src/lib/shared/grid.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/designer/src/lib/shared/grid.cpp b/tools/designer/src/lib/shared/grid.cpp
index 6add8bd..ba991c7 100644
--- a/tools/designer/src/lib/shared/grid.cpp
+++ b/tools/designer/src/lib/shared/grid.cpp
@@ -89,12 +89,20 @@ Grid::Grid() :
bool Grid::fromVariantMap(const QVariantMap& vm)
{
- *this = Grid();
- valueFromVariantMap(vm, QLatin1String(KEY_VISIBLE), m_visible);
- valueFromVariantMap(vm, QLatin1String(KEY_SNAPX), m_snapX);
- valueFromVariantMap(vm, QLatin1String(KEY_SNAPY), m_snapY);
- valueFromVariantMap(vm, QLatin1String(KEY_DELTAX), m_deltaX);
- return valueFromVariantMap(vm, QLatin1String(KEY_DELTAY), m_deltaY);
+ Grid grid;
+ bool anyData = valueFromVariantMap(vm, QLatin1String(KEY_VISIBLE), grid.m_visible);
+ anyData |= valueFromVariantMap(vm, QLatin1String(KEY_SNAPX), grid.m_snapX);
+ anyData |= valueFromVariantMap(vm, QLatin1String(KEY_SNAPY), grid.m_snapY);
+ anyData |= valueFromVariantMap(vm, QLatin1String(KEY_DELTAX), grid.m_deltaX);
+ anyData |= valueFromVariantMap(vm, QLatin1String(KEY_DELTAY), grid.m_deltaY);
+ if (!anyData)
+ return false;
+ if (grid.m_deltaX == 0 || grid.m_deltaY == 0) {
+ qWarning("Attempt to set invalid grid with a spacing of 0.");
+ return false;
+ }
+ *this = grid;
+ return true;
}
QVariantMap Grid::toVariantMap(bool forceKeys) const