OSDN Git Service

qdesigner_internal::LayoutInfo cleanup
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 8 Jun 2019 11:31:14 +0000 (11:31 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 8 Jun 2019 11:31:14 +0000 (11:31 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/designer/components/formeditor/formwindowmanager.cpp
src/designer/shared/layoutinfo.cpp
src/designer/shared/layoutinfo_p.h
src/designer/shared/qdesigner_propertysheet.cpp
src/designer/shared/qdesigner_propertysheet_p.h

index 51ee0da..bc5bb50 100644 (file)
@@ -880,7 +880,7 @@ void FormWindowManager::slotUpdateActions()
         if (!item)
             break;
 
-        QLayout *widgetLayout = LayoutInfo::internalLayout(widget);
+        QLayout *widgetLayout = widget->layout();
         QLayout *managedLayout = LayoutInfo::managedLayout(m_core, widgetLayout);
         // We don't touch a layout createds by a custom widget
         if (widgetLayout && !managedLayout)
index cfb129f..5a46ed6 100644 (file)
@@ -208,20 +208,6 @@ LayoutInfo::Type LayoutInfo::laidoutWidgetType(const QDesignerFormEditorInterfac
     return NoLayout;
 }
 
-QLayout *LayoutInfo::internalLayout(const QWidget *widget)
-{
-    QLayout *widgetLayout = widget->layout();
-    if (widgetLayout && widget->inherits("Q3GroupBox")) {
-        if (widgetLayout->count()) {
-            widgetLayout = widgetLayout->itemAt(0)->layout();
-        } else {
-            widgetLayout = 0;
-        }
-    }
-    return widgetLayout;
-}
-
-
 QLayout *LayoutInfo::managedLayout(const QDesignerFormEditorInterface *core, const QWidget *widget)
 {
     if (widget == 0)
index 6d27f08..2dc19f7 100644 (file)
@@ -91,7 +91,6 @@ public:
 
     static QLayout *managedLayout(const QDesignerFormEditorInterface *core, const QWidget *widget);
     static QLayout *managedLayout(const QDesignerFormEditorInterface *core, QLayout *layout);
-    static QLayout *internalLayout(const QWidget *widget);
 
     // Is it a a dummy grid placeholder created by Designer?
     static bool isEmptyItem(QLayoutItem *item);
index e8695f9..c1c0a84 100644 (file)
@@ -406,7 +406,7 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension *
         return 0;
 
     QWidget *widget = qobject_cast<QWidget*>(m_object);
-    QLayout *widgetLayout = qdesigner_internal::LayoutInfo::internalLayout(widget);
+    QLayout *widgetLayout = widget->layout();
     if (!widgetLayout) {
         m_lastLayout = 0;
         m_lastLayoutPropertySheet = 0;
@@ -494,9 +494,6 @@ QDesignerPropertySheet::ObjectType QDesignerPropertySheet::objectTypeFromObject(
     if (qobject_cast<const QLabel*>(o))
         return ObjectLabel;
 
-    if (o->inherits("Q3GroupBox"))
-        return ObjectQ3GroupBox;
-
     return ObjectNone;
 }
 
@@ -1247,38 +1244,14 @@ bool QDesignerPropertySheet::reset(int index)
            // special margins
             int value = -1;
             switch (d->m_objectType) {
-            case ObjectQ3GroupBox: {
-                const QWidget *w = qobject_cast<const QWidget *>(d->m_object);
-                switch (pType) {
-                case PropertyLayoutLeftMargin:
-                    value = w->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
-                    break;
-                case PropertyLayoutTopMargin:
-                    value = w->style()->pixelMetric(QStyle::PM_LayoutTopMargin);
-                    break;
-                case PropertyLayoutRightMargin:
-                    value = w->style()->pixelMetric(QStyle::PM_LayoutRightMargin);
-                    break;
-                case PropertyLayoutBottomMargin:
-                    value = w->style()->pixelMetric(QStyle::PM_LayoutBottomMargin);
-                    break;
-                case PropertyLayoutSpacing:
-                case PropertyLayoutHorizontalSpacing:
-                case PropertyLayoutVerticalSpacing:
-                    value = -1;
-                    break;
-                default:
-                    break;
-                }
-            }
-                break;
-            case ObjectLayoutWidget:
+            case ObjectLayoutWidget: {
                 if (pType == PropertyLayoutLeftMargin ||
                         pType == PropertyLayoutTopMargin ||
                         pType == PropertyLayoutRightMargin ||
                         pType == PropertyLayoutBottomMargin)
                     value = 0;
                 break;
+            }
             default:
                 break;
             }
index 7ab2d29..c422e79 100644 (file)
@@ -172,7 +172,7 @@ public:
                         PropertyText
     };
 
-    enum ObjectType { ObjectNone, ObjectLabel, ObjectLayout, ObjectLayoutWidget, ObjectQ3GroupBox };
+    enum ObjectType { ObjectNone, ObjectLabel, ObjectLayout, ObjectLayoutWidget };
 
     static ObjectType objectTypeFromObject(const QObject *o);
     static PropertyType propertyTypeFromName(const QString &name);