BarDescriptorEditor: Create widget from editor

Not the other way round. Results in less, and less convoluted code.

Change-Id: I58a8d1e7785c0d712ff518d38425fc5646a262dd
Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2014-01-14 13:07:51 +01:00
parent fc9a99fc02
commit c1ff266e3e
5 changed files with 11 additions and 21 deletions

View File

@@ -51,9 +51,9 @@
using namespace Qnx;
using namespace Qnx::Internal;
BarDescriptorEditorWidget::BarDescriptorEditorWidget(QWidget *parent)
BarDescriptorEditorWidget::BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent)
: QStackedWidget(parent)
, m_editor(0)
, m_editor(editor)
, m_dirty(false)
{
Core::IContext *myContext = new Core::IContext(this);
@@ -170,11 +170,6 @@ void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *pan
Core::IEditor *BarDescriptorEditorWidget::editor() const
{
if (!m_editor) {
m_editor = const_cast<BarDescriptorEditorWidget *>(this)->createEditor();
connect(this, SIGNAL(changed()), m_editor->document(), SIGNAL(changed()));
}
return m_editor;
}
@@ -269,8 +264,3 @@ void BarDescriptorEditorWidget::setDirty(bool dirty)
m_dirty = dirty;
emit changed();
}
BarDescriptorEditor *BarDescriptorEditorWidget::createEditor()
{
return new BarDescriptorEditor(this);
}