summaryrefslogtreecommitdiffstats
path: root/tools/designer
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-02 16:04:01 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-02 16:04:01 (GMT)
commit5f073cb596b938c1b39621cefd38a3decc6f6fa2 (patch)
tree52db9d364148a9d297213d95238acdb9523dbc57 /tools/designer
parentca618a657879700ca147bf29c8770e0b458f3e19 (diff)
parent95b17fbe91eb3b1b0fcac92d8a8934769e4cd847 (diff)
downloadQt-5f073cb596b938c1b39621cefd38a3decc6f6fa2.zip
Qt-5f073cb596b938c1b39621cefd38a3decc6f6fa2.tar.gz
Qt-5f073cb596b938c1b39621cefd38a3decc6f6fa2.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'tools/designer')
-rw-r--r--tools/designer/src/lib/shared/layout.cpp22
-rw-r--r--tools/designer/src/lib/shared/qlayout_widget.cpp3
2 files changed, 15 insertions, 10 deletions
diff --git a/tools/designer/src/lib/shared/layout.cpp b/tools/designer/src/lib/shared/layout.cpp
index c9ffe71..9fe438b 100644
--- a/tools/designer/src/lib/shared/layout.cpp
+++ b/tools/designer/src/lib/shared/layout.cpp
@@ -996,13 +996,23 @@ bool Grid::shrinkFormLayoutSpans()
for (WidgetSet::const_iterator it = widgets.constBegin(); it != cend ; ++it) {
QWidget *w = *it;
int row, col, rowspan, colspan;
- locateWidget(w, row, col, rowspan, colspan);
+ if (!locateWidget(w, row, col, rowspan, colspan))
+ qDebug("ooops, widget '%s' does not fit in layout", w->objectName().toUtf8().constData());
const int maxColSpan = col == 0 ? 2 : 1;
const int newColSpan = qMin(colspan, maxColSpan);
const int newRowSpan = qMin(rowspan, maxRowSpan);
if (newColSpan != colspan || newRowSpan != rowspan) {
- setCells(QRect(col, row, colspan, rowspan), 0);
- setCells(QRect(col, row, newColSpan, newRowSpan), w);
+ // in case like this:
+ // W1 W1
+ // W1 W2
+ // do:
+ // W1 0
+ // 0 W2
+ for (int i = row; i < row + rowspan - 1; i++)
+ for (int j = col; j < col + colspan - 1; j++)
+ if (i > row + newColSpan - 1 || j > col + newRowSpan - 1)
+ if (cell(i, j) == w)
+ setCell(i, j, 0);
shrunk = true;
}
}
@@ -1177,11 +1187,7 @@ void GridLayout<GridLikeLayout, LayoutType, GridMode>::doLayout()
if (const Spacer *spacer = qobject_cast<const Spacer*>(w))
alignment = spacer->alignment();
- if (rs * cs == 1) {
- addWidgetToGrid(layout, w, r, c, 1, 1, alignment);
- } else {
- addWidgetToGrid(layout, w, r, c, rs, cs, alignment);
- }
+ addWidgetToGrid(layout, w, r, c, rs, cs, alignment);
w->show();
} else {
diff --git a/tools/designer/src/lib/shared/qlayout_widget.cpp b/tools/designer/src/lib/shared/qlayout_widget.cpp
index e9cf51a..66e7a79 100644
--- a/tools/designer/src/lib/shared/qlayout_widget.cpp
+++ b/tools/designer/src/lib/shared/qlayout_widget.cpp
@@ -1189,8 +1189,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
} else {
for (int c = 0; c < FormLayoutColumns; c++) {
const QFormLayout::ItemRole role = c == 0 ? QFormLayout::LabelRole : QFormLayout::FieldRole;
- if (widgets[c]) {
- Q_ASSERT(BoxLayoutHelper::findItemOfWidget(items, widgets[c]));
+ if (widgets[c] && BoxLayoutHelper::findItemOfWidget(items, widgets[c])) {
formLayout->setWidget(r, role, widgets[c]);
} else {
formLayout->setItem(r, role, createFormSpacer());