summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSami Lempinen <sami.lempinen@nokia.com>2011-10-03 12:07:49 (GMT)
committerSami Lempinen <sami.lempinen@nokia.com>2011-10-03 12:07:49 (GMT)
commitd22211b970dbab1382c97ef8259c91adc2b8a4de (patch)
tree8e2a946b25ea187b18777018e19b21e2c5bf9df3 /tools
parentb4fb55db3939219e976d53c32b42bf28acaa41b1 (diff)
parent1f459f4040845919ffd46cea35958486f41abb3c (diff)
downloadQt-d22211b970dbab1382c97ef8259c91adc2b8a4de.zip
Qt-d22211b970dbab1382c97ef8259c91adc2b8a4de.tar.gz
Qt-d22211b970dbab1382c97ef8259c91adc2b8a4de.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/lib/uilib/abstractformbuilder.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
index 81f1a3b..665badb 100644
--- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -1452,6 +1452,8 @@ struct FormBuilderSaveLayoutEntry {
explicit FormBuilderSaveLayoutEntry(QLayoutItem *li = 0) :
item(li), row(-1), column(-1), rowSpan(0), columnSpan(0), alignment(0) {}
+ void setAlignment(Qt::Alignment al);
+
QLayoutItem *item;
int row;
int column;
@@ -1460,6 +1462,20 @@ struct FormBuilderSaveLayoutEntry {
Qt::Alignment alignment;
};
+// filter out the case of "Spacer" and "QLayoutWidget" widgets
+void FormBuilderSaveLayoutEntry::setAlignment(Qt::Alignment al)
+{
+ if (!item->widget())
+ return;
+
+ const QString className = item->widget()->metaObject()->className();
+ if (className == QLatin1String("Spacer")
+ || className == QLatin1String("QLayoutWidget"))
+ return;
+
+ alignment = al;
+}
+
// Create list from standard box layout
static QList<FormBuilderSaveLayoutEntry> saveLayoutEntries(const QLayout *layout)
{
@@ -1469,7 +1485,7 @@ static QList<FormBuilderSaveLayoutEntry> saveLayoutEntries(const QLayout *layout
for (int idx = 0; idx < count; ++idx) {
QLayoutItem *item = layout->itemAt(idx);
FormBuilderSaveLayoutEntry entry(item);
- entry.alignment = item->alignment();
+ entry.setAlignment(item->alignment());
rc.append(entry);
}
}
@@ -1486,7 +1502,7 @@ static QList<FormBuilderSaveLayoutEntry> saveGridLayoutEntries(QGridLayout *grid
QLayoutItem *item = gridLayout->itemAt(idx);
FormBuilderSaveLayoutEntry entry(item);
gridLayout->getItemPosition(idx, &entry.row, &entry.column, &entry.rowSpan,&entry.columnSpan);
- entry.alignment = item->alignment();
+ entry.setAlignment(item->alignment());
rc.append(entry);
}
}