summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-08-01 17:54:26 +0200
committerChristian Stenger <christian.stenger@digia.com>2014-08-04 13:32:08 +0200
commitc44f09caeb9df5ed4d02248ecbc9c1b5ce767c37 (patch)
tree9fae09093e0eea933aca1f2ed5ba7d933e98907e
parentd7c2b0b6810adc109201f5f3c1088d3b0f109f70 (diff)
downloadqt-creator-c44f09caeb9df5ed4d02248ecbc9c1b5ce767c37.tar.gz
GLSL: Move toolbar creation to Widget constructor
It doesn't need the editor parameter anymore, so the two-phase setup can go. Note that both paths through ctor() finally hit *Widget::createEditor() (one directly, one indirectly through the first BaseTextEditorWidget::editor() call), so this doesn't change what's set up, only when. Change-Id: If92a7e2a60ea3df417ecdeabc6f8e9dc3a23e4f8 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp49
-rw-r--r--src/plugins/glsleditor/glsleditor.h1
2 files changed, 22 insertions, 28 deletions
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index fdffd25d79..844adcfb02 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -168,6 +168,27 @@ void GlslEditorWidget::ctor()
new Highlighter(textDocument());
+ m_outlineCombo = new QComboBox;
+ m_outlineCombo->setMinimumContentsLength(22);
+
+ // ### m_outlineCombo->setModel(m_outlineModel);
+
+ QTreeView *treeView = new QTreeView;
+ treeView->header()->hide();
+ treeView->setItemsExpandable(false);
+ treeView->setRootIsDecorated(false);
+ m_outlineCombo->setView(treeView);
+ treeView->expandAll();
+
+ //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
+ // Make the combo box prefer to expand
+ QSizePolicy policy = m_outlineCombo->sizePolicy();
+ policy.setHorizontalPolicy(QSizePolicy::Expanding);
+ m_outlineCombo->setSizePolicy(policy);
+
+ insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_outlineCombo);
+
// if (m_modelManager) {
// m_semanticHighlighter->setModelManager(m_modelManager);
// connect(m_modelManager, SIGNAL(documentUpdated(GLSL::Document::Ptr)),
@@ -222,33 +243,7 @@ QString GlslEditorWidget::wordUnderCursor() const
TextEditor::BaseTextEditor *GlslEditorWidget::createEditor()
{
- GlslEditor *editable = new GlslEditor(this);
- createToolBar(editable);
- return editable;
-}
-
-void GlslEditorWidget::createToolBar(GlslEditor *editor)
-{
- m_outlineCombo = new QComboBox;
- m_outlineCombo->setMinimumContentsLength(22);
-
- // ### m_outlineCombo->setModel(m_outlineModel);
-
- QTreeView *treeView = new QTreeView;
- treeView->header()->hide();
- treeView->setItemsExpandable(false);
- treeView->setRootIsDecorated(false);
- m_outlineCombo->setView(treeView);
- treeView->expandAll();
-
- //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-
- // Make the combo box prefer to expand
- QSizePolicy policy = m_outlineCombo->sizePolicy();
- policy.setHorizontalPolicy(QSizePolicy::Expanding);
- m_outlineCombo->setSizePolicy(policy);
-
- insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_outlineCombo);
+ return new GlslEditor(this);
}
void GlslEditorWidget::updateDocument()
diff --git a/src/plugins/glsleditor/glsleditor.h b/src/plugins/glsleditor/glsleditor.h
index 39f185a754..380a7be537 100644
--- a/src/plugins/glsleditor/glsleditor.h
+++ b/src/plugins/glsleditor/glsleditor.h
@@ -105,7 +105,6 @@ private slots:
protected:
TextEditor::BaseTextEditor *createEditor();
- void createToolBar(Internal::GlslEditor *editable);
private:
GlslEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity