summaryrefslogtreecommitdiffstats
path: root/tools/designer/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-11 13:12:48 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-11 13:12:48 (GMT)
commitddd56e9fa49fd597785a3e9b5dbd5ea6b25d1cac (patch)
tree7665e67582aaa90c86409bfd2899f9757f8fef13 /tools/designer/src
parentdddc08c5e28e7b57a2a1f1276b7827d2e354599c (diff)
parent8c144f94ee8c391c5ca9ba4c8de93dc5566cbf57 (diff)
downloadQt-ddd56e9fa49fd597785a3e9b5dbd5ea6b25d1cac.zip
Qt-ddd56e9fa49fd597785a3e9b5dbd5ea6b25d1cac.tar.gz
Qt-ddd56e9fa49fd597785a3e9b5dbd5ea6b25d1cac.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'tools/designer/src')
-rw-r--r--tools/designer/src/components/formeditor/formwindow.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp
index ebf00f9..88b86d8 100644
--- a/tools/designer/src/components/formeditor/formwindow.cpp
+++ b/tools/designer/src/components/formeditor/formwindow.cpp
@@ -1683,10 +1683,13 @@ void FormWindow::cut()
// for cases like QMainWindow (central widget is an inner container) or QStackedWidget (page is an inner container)
QWidget *FormWindow::innerContainer(QWidget *outerContainer) const
{
- bool isContainer = m_core->widgetDataBase()->isContainer(outerContainer);
- if (isContainer)
- if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(m_core->extensionManager(), outerContainer))
- return container->widget(container->currentIndex());
+ if (m_core->widgetDataBase()->isContainer(outerContainer))
+ if (const QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(m_core->extensionManager(), outerContainer)) {
+ const int currentIndex = container->currentIndex();
+ return currentIndex >= 0 ?
+ container->widget(currentIndex) :
+ static_cast<QWidget *>(0);
+ }
return outerContainer;
}
@@ -1706,8 +1709,10 @@ QWidget *FormWindow::containerForPaste() const
QWidget *containerOfW = findContainer(selection.first(), /* exclude layouts */ true);
if (!containerOfW || containerOfW == mainContainer())
break;
- // No layouts, must be container
+ // No layouts, must be container. No empty page-based containers.
containerOfW = innerContainer(containerOfW);
+ if (!containerOfW)
+ break;
if (LayoutInfo::layoutType(m_core, containerOfW) != LayoutInfo::NoLayout || !m_core->widgetDataBase()->isContainer(containerOfW))
break;
w = containerOfW;
@@ -1716,6 +1721,8 @@ QWidget *FormWindow::containerForPaste() const
// and the like as the central widget has the layout).
w = innerContainer(w);
+ if (!w)
+ return 0;
if (LayoutInfo::layoutType(m_core, w) != LayoutInfo::NoLayout)
return 0;
// Go up via container extension (also includes step from QMainWindow to its central widget)