Making the find tool bar be more connected to the searched text.

This commit is contained in:
con
2009-07-21 11:10:02 +02:00
parent e1362eab38
commit 091f372723
14 changed files with 124 additions and 55 deletions

View File

@@ -30,6 +30,8 @@
#include "findplaceholder.h"
#include "modemanager.h"
#include <extensionsystem/pluginmanager.h>
#include <QtGui/QVBoxLayout>
@@ -37,29 +39,31 @@ using namespace Core;
FindToolBarPlaceHolder *FindToolBarPlaceHolder::m_current = 0;
FindToolBarPlaceHolder::FindToolBarPlaceHolder(Core::IMode *mode, QWidget *parent)
: QWidget(parent), m_mode(mode)
FindToolBarPlaceHolder::FindToolBarPlaceHolder(QWidget *owner, QWidget *parent)
: QWidget(parent), m_widget(owner)
{
setLayout(new QVBoxLayout);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
layout()->setMargin(0);
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode *)),
this, SLOT(currentModeChanged(Core::IMode *)));
ExtensionSystem::PluginManager::instance()->addObject(this);
}
FindToolBarPlaceHolder::~FindToolBarPlaceHolder()
{
ExtensionSystem::PluginManager::instance()->removeObject(this);
}
void FindToolBarPlaceHolder::currentModeChanged(Core::IMode *mode)
QWidget *FindToolBarPlaceHolder::widget() const
{
if (m_current == this)
m_current = 0;
if (m_mode == mode)
m_current = this;
return m_widget;
}
FindToolBarPlaceHolder *FindToolBarPlaceHolder::getCurrent()
{
return m_current;
}
void FindToolBarPlaceHolder::setCurrent(FindToolBarPlaceHolder *placeHolder)
{
m_current = placeHolder;
}