From 195efe4ebab933bfbba7f7bf06cf4592b865d008 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 18 Aug 2012 19:04:43 +0200 Subject: blah, an attempt to sort out the weird resizing of the scene tree --- lslayoutwindow.cpp | 21 +++++++++++++++------ lslayoutwindow.h | 4 ++++ lspaneeditor.cpp | 4 ---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lslayoutwindow.cpp b/lslayoutwindow.cpp index 718e92d..867b6c8 100644 --- a/lslayoutwindow.cpp +++ b/lslayoutwindow.cpp @@ -5,7 +5,6 @@ #include #include #include -#include LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, QWidget *parent) : QMainWindow(parent) { @@ -50,7 +49,7 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q m_tabWidget->addTab(w, "Layout"); // prepare the Scene Graph tab - QSplitter *gsplit = new QSplitter(this); + m_sceneSplitter = new QSplitter(this); w = new QWidget(this); QGridLayout *ggrid = new QGridLayout(w); @@ -71,12 +70,19 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q ggrid->addWidget(m_clearSearchButton, 0, 1, 1, 1); ggrid->addLayout(m_sceneListSwitcher, 1, 0, 1, 2); - m_paneEditor = new LSPaneEditor(this); + QWidget *switcherWidget = new QWidget(this); + m_paneEditorSwitcher = new QStackedLayout(switcherWidget); - gsplit->addWidget(w); - gsplit->addWidget(m_paneEditor); + m_paneEditor = new LSPaneEditor(switcherWidget); - m_tabWidget->addTab(gsplit, "Scene Graph"); + m_paneEditorSwitcher->addWidget(new QLabel("Choose a pane to edit from the left.", switcherWidget)); + m_paneEditorSwitcher->addWidget(m_paneEditor); + + m_sceneSplitter->addWidget(w); + m_sceneSplitter->addWidget(switcherWidget); + m_sceneSplitter->setCollapsible(1, false); + + m_tabWidget->addTab(m_sceneSplitter, "Scene Graph"); // get the resource @@ -125,8 +131,11 @@ LSLayoutWindow::~LSLayoutWindow() { void LSLayoutWindow::selectedPaneChanged(const QModelIndex ¤t, const QModelIndex &previous) { + (void)previous; LYTPane *pane = (LYTPane*)current.internalPointer(); + m_paneEditor->setPane(pane); + m_paneEditorSwitcher->setCurrentIndex(1); } diff --git a/lslayoutwindow.h b/lslayoutwindow.h index a626b25..b2c4385 100644 --- a/lslayoutwindow.h +++ b/lslayoutwindow.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "lyt/packagebase.h" #include "lyt/layout.h" class LSPaneEditor; @@ -38,12 +39,15 @@ private: QDoubleSpinBox *m_widthBox, *m_heightBox; // scene graph + QSplitter *m_sceneSplitter; + QStackedLayout *m_sceneListSwitcher; QLineEdit *m_searchBox; QPushButton *m_clearSearchButton; QTreeView *m_sceneGraph; QListView *m_sceneSearchList; + QStackedLayout *m_paneEditorSwitcher; LSPaneEditor *m_paneEditor; bool m_loadingSettings; diff --git a/lspaneeditor.cpp b/lspaneeditor.cpp index e63cb4f..5548b75 100644 --- a/lspaneeditor.cpp +++ b/lspaneeditor.cpp @@ -25,7 +25,6 @@ LSPaneEditor::LSPaneEditor(QWidget *parent) : m_removeButton->setText("Remove This Pane"); m_tabs = new QTabWidget(this); - m_tabs->setVisible(false); QGridLayout *layout = new QGridLayout(this); @@ -176,9 +175,6 @@ void LSPaneEditor::setPane(LYTPane *pane) { m_currentlyLoadingPane = true; m_pane = pane; - m_tabs->setVisible(true); - - m_nameEntry->setText(pane->name); m_userDataEntry->setText(pane->userdata); -- cgit v1.2.3