Make the debugger left panel resizable.
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 21 Nov 2013 13:41:37 +0000 (13:41 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 21 Nov 2013 13:41:37 +0000 (13:41 +0000)
Use QSplitters to allow resizing the left debugger panels.

R=robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/79573002

git-svn-id: http://skia.googlecode.com/svn/trunk@12336 2bbb7eff-a529-9590-31e7-b0007b416f81

debugger/QT/SkDebuggerGUI.cpp
debugger/QT/SkDebuggerGUI.h

index fad5c0cd554b37fa4b071d56922201a0cd9b9edf..f500dcf9e88b2898c1c85011992585f23e683011 100644 (file)
@@ -29,7 +29,7 @@ __SK_FORCE_IMAGE_DECODER_LINKING;
 
 SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
         QMainWindow(parent)
-    , fCentralWidget(this)
+    , fCentralSplitter(this)
     , fStatusBar(this)
     , fToolBar(this)
     , fActionOpen(this)
@@ -56,8 +56,8 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
     , fActionZoomIn(this)
     , fActionZoomOut(this)
     , fMapper(this)
-    , fListWidget(&fCentralWidget)
-    , fDirectoryWidget(&fCentralWidget)
+    , fListWidget(&fCentralSplitter)
+    , fDirectoryWidget(&fCentralSplitter)
     , fCanvasWidget(this, &fDebugger)
     , fImageWidget(&fDebugger)
     , fMenuBar(this)
@@ -801,11 +801,11 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) {
 
     fListWidget.setItemDelegate(new SkListWidget(&fListWidget));
     fListWidget.setObjectName(QString::fromUtf8("listWidget"));
-    fListWidget.setMaximumWidth(250);
+    fListWidget.setMinimumWidth(250);
 
     fFilter.addItem("--Filter By Available Commands--");
 
-    fDirectoryWidget.setMaximumWidth(250);
+    fDirectoryWidget.setMinimumWidth(250);
     fDirectoryWidget.setStyleSheet("QListWidget::Item {padding: 5px;}");
 
     fCanvasWidget.setSizePolicy(QSizePolicy::Expanding,
@@ -826,26 +826,25 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) {
             QSizePolicy::Expanding);
     fSettingsWidget.setMaximumWidth(250);
 
-    fLeftColumnLayout.setSpacing(6);
-    fLeftColumnLayout.addWidget(&fListWidget);
-    fLeftColumnLayout.addWidget(&fDirectoryWidget);
+    fLeftColumnSplitter.addWidget(&fListWidget);
+    fLeftColumnSplitter.addWidget(&fDirectoryWidget);
+    fLeftColumnSplitter.setOrientation(Qt::Vertical);
 
     fCanvasSettingsAndImageLayout.setSpacing(6);
     fCanvasSettingsAndImageLayout.addWidget(&fCanvasWidget);
     fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout);
 
-
     fMainAndRightColumnLayout.setSpacing(6);
     fMainAndRightColumnLayout.addLayout(&fCanvasSettingsAndImageLayout);
     fMainAndRightColumnLayout.addWidget(&fInspectorWidget);
+    fMainAndRightColumnWidget.setLayout(&fMainAndRightColumnLayout);
 
-    fCentralWidget.setLayout(&fContainerLayout);
-    fContainerLayout.setSpacing(6);
-    fContainerLayout.setContentsMargins(11, 11, 11, 11);
-    fContainerLayout.addLayout(&fLeftColumnLayout);
-    fContainerLayout.addLayout(&fMainAndRightColumnLayout);
+    fCentralSplitter.addWidget(&fLeftColumnSplitter);
+    fCentralSplitter.addWidget(&fMainAndRightColumnWidget);
+    fCentralSplitter.setStretchFactor(0, 0);
+    fCentralSplitter.setStretchFactor(1, 1);
 
-    SkDebuggerGUI->setCentralWidget(&fCentralWidget);
+    SkDebuggerGUI->setCentralWidget(&fCentralSplitter);
     SkDebuggerGUI->setStatusBar(&fStatusBar);
 
     fToolBar.setIconSize(QSize(32, 32));
index a478428505c096887fe39e24141af8325956a9bf..cdda861acb4eddaa9fec7f971c129511c342d8d5 100644 (file)
@@ -28,6 +28,7 @@
 #include <QtGui/QListView>
 #include <QtGui/QListWidget>
 #include <QtGui/QMainWindow>
+#include <QtGui/QSplitter>
 #include <QtGui/QStatusBar>
 #include <QtGui/QToolBar>
 #include <QtGui/QVBoxLayout>
@@ -234,7 +235,7 @@ private slots:
     void toggleFilter(QString string);
 
 private:
-    QWidget fCentralWidget;
+    QSplitter fCentralSplitter;
     QStatusBar fStatusBar;
     QToolBar fToolBar;
 
@@ -266,8 +267,8 @@ private:
     QWidget fSpacer;
     QComboBox fFilter;
 
-    QHBoxLayout fContainerLayout;
-    QVBoxLayout fLeftColumnLayout;
+    QSplitter fLeftColumnSplitter;
+    QWidget fMainAndRightColumnWidget;
     QVBoxLayout fMainAndRightColumnLayout;
     QHBoxLayout fCanvasSettingsAndImageLayout;
     QVBoxLayout fSettingsAndImageLayout;