diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-02-01 17:25:38 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-02-01 17:25:38 (GMT) |
commit | 95b17fbe91eb3b1b0fcac92d8a8934769e4cd847 (patch) | |
tree | b5a1e5549a118ea5e4da612fc40d814ca2e9c401 /tools/designer | |
parent | e5974b024828578945bd4c349f5f87f82a635225 (diff) | |
parent | bb84c5ef4f620af659395b66e6ed792a380b9a1f (diff) | |
download | Qt-95b17fbe91eb3b1b0fcac92d8a8934769e4cd847.zip Qt-95b17fbe91eb3b1b0fcac92d8a8934769e4cd847.tar.gz Qt-95b17fbe91eb3b1b0fcac92d8a8934769e4cd847.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Don't ignore source-text when generating qsTrId translations for QML
Fix a crash when undoing form layout
Diffstat (limited to 'tools/designer')
-rw-r--r-- | tools/designer/src/lib/shared/layout.cpp | 22 | ||||
-rw-r--r-- | tools/designer/src/lib/shared/qlayout_widget.cpp | 3 |
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 20db606..4debb5e 100644 --- a/tools/designer/src/lib/shared/qlayout_widget.cpp +++ b/tools/designer/src/lib/shared/qlayout_widget.cpp @@ -1181,8 +1181,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()); |