aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/rightpane.cpp
diff options
context:
space:
mode:
authorPasi Hirvonen <pasi.hirvonen@digia.com>2011-02-24 14:00:04 +0200
committerdt <qtc-committer@nokia.com>2011-02-24 19:10:58 +0100
commitd28dc2d98929cc3ba9e6b80b10751bb4534775da (patch)
tree51d17bee5a422cd2505c949c0f05803542687ab0 /src/plugins/coreplugin/rightpane.cpp
parente48cce07398704697d85e5bc49f769a6bb9a7cef (diff)
coreplugin: Make RightPaneWidget more widely usable.
RightPaneWidget now has setWidget() and is no longer intimately tied to the help plugin. Help plugin now uses setWidget(). Reviewed-By: dt
Diffstat (limited to 'src/plugins/coreplugin/rightpane.cpp')
-rw-r--r--src/plugins/coreplugin/rightpane.cpp62
1 files changed, 18 insertions, 44 deletions
diff --git a/src/plugins/coreplugin/rightpane.cpp b/src/plugins/coreplugin/rightpane.cpp
index d51882c6ad..e321d0787f 100644
--- a/src/plugins/coreplugin/rightpane.cpp
+++ b/src/plugins/coreplugin/rightpane.cpp
@@ -34,7 +34,6 @@
#include "rightpane.h"
#include <coreplugin/modemanager.h>
-#include <extensionsystem/pluginmanager.h>
#include <QtCore/QSettings>
@@ -129,53 +128,38 @@ void RightPanePlaceHolder::currentModeChanged(Core::IMode *mode)
RightPaneWidget *RightPaneWidget::m_instance = 0;
RightPaneWidget::RightPaneWidget()
- : m_shown(true), m_width(0)
+ : m_shown(true), m_width(0), m_widget(0)
{
m_instance = this;
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
setLayout(layout);
-
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
-
- BaseRightPaneWidget *rpw = pm->getObject<BaseRightPaneWidget>();
- if (rpw) {
- layout->addWidget(rpw->widget());
- }
- connect(pm, SIGNAL(objectAdded(QObject *)),
- this, SLOT(objectAdded(QObject *)));
- connect(pm, SIGNAL(aboutToRemoveObject(QObject *)),
- this, SLOT(aboutToRemoveObject(QObject *)));
}
RightPaneWidget::~RightPaneWidget()
{
+ clearWidget();
m_instance = 0;
}
-void RightPaneWidget::objectAdded(QObject *obj)
+RightPaneWidget *RightPaneWidget::instance()
{
- BaseRightPaneWidget *rpw = qobject_cast<BaseRightPaneWidget *>(obj);
- if (rpw) {
- layout()->addWidget(rpw->widget());
- setFocusProxy(rpw->widget());
- }
+ return m_instance;
}
-void RightPaneWidget::aboutToRemoveObject(QObject *obj)
+void RightPaneWidget::setWidget(QWidget *widget)
{
- BaseRightPaneWidget *rpw = qobject_cast<BaseRightPaneWidget *>(obj);
- if (rpw) {
- delete rpw->widget();
+ clearWidget();
+ m_widget = widget;
+ if (m_widget) {
+ m_widget->setParent(this);
+ layout()->addWidget(m_widget);
+ setFocusProxy(m_widget);
+ m_widget->show();
}
}
-RightPaneWidget *RightPaneWidget::instance()
-{
- return m_instance;
-}
-
int RightPaneWidget::storedWidth()
{
return m_width;
@@ -227,21 +211,11 @@ bool RightPaneWidget::isShown()
return m_shown;
}
-/////
-// BaseRightPaneWidget
-/////
-
-BaseRightPaneWidget::BaseRightPaneWidget(QWidget *widget)
-{
- m_widget = widget;
-}
-
-BaseRightPaneWidget::~BaseRightPaneWidget()
-{
-
-}
-
-QWidget *BaseRightPaneWidget::widget() const
+void RightPaneWidget::clearWidget()
{
- return m_widget;
+ if (m_widget) {
+ m_widget->hide();
+ m_widget->setParent(0);
+ m_widget = 0;
+ }
}