Commit c44f09ca authored by hjk's avatar hjk Committed by Christian Stenger
Browse files

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: default avatarTobias Hunger <tobias.hunger@digia.com>
parent d7c2b0b6
...@@ -168,6 +168,27 @@ void GlslEditorWidget::ctor() ...@@ -168,6 +168,27 @@ void GlslEditorWidget::ctor()
new Highlighter(textDocument()); 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) { // if (m_modelManager) {
// m_semanticHighlighter->setModelManager(m_modelManager); // m_semanticHighlighter->setModelManager(m_modelManager);
// connect(m_modelManager, SIGNAL(documentUpdated(GLSL::Document::Ptr)), // connect(m_modelManager, SIGNAL(documentUpdated(GLSL::Document::Ptr)),
...@@ -222,33 +243,7 @@ QString GlslEditorWidget::wordUnderCursor() const ...@@ -222,33 +243,7 @@ QString GlslEditorWidget::wordUnderCursor() const
TextEditor::BaseTextEditor *GlslEditorWidget::createEditor() TextEditor::BaseTextEditor *GlslEditorWidget::createEditor()
{ {
GlslEditor *editable = new GlslEditor(this); return 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);
} }
void GlslEditorWidget::updateDocument() void GlslEditorWidget::updateDocument()
......
...@@ -105,7 +105,6 @@ private slots: ...@@ -105,7 +105,6 @@ private slots:
protected: protected:
TextEditor::BaseTextEditor *createEditor(); TextEditor::BaseTextEditor *createEditor();
void createToolBar(Internal::GlslEditor *editable);
private: private:
GlslEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity GlslEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment