forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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
|
|||||||
|
|
||||||
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:
|
|||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user