┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/tooltips/tooltipmanager.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-03-22 18:43:12 +0100
committerPeter Penz <[email protected]>2011-03-22 18:46:11 +0100
commite3063e001a016849276b65527ac56c26d56b5f30 (patch)
tree5f9c230a21f3cf6c4ad75cb0be085c06ebcf1d2b /src/views/tooltips/tooltipmanager.cpp
parentdfe02a06b5de4df9def4f16fa6d1829887b18247 (diff)
Tooltip improvements
- Use the default style for drawing the tooltip background - Get rid of the workaround to keep only one KFileMetaDataWidget instance. This is not required anymore as internally in KFileMetaDataWidget a process is used to get the metadata instead of a thread.
Diffstat (limited to 'src/views/tooltips/tooltipmanager.cpp')
-rw-r--r--src/views/tooltips/tooltipmanager.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp
index 44e60049f..f93dd90be 100644
--- a/src/views/tooltips/tooltipmanager.cpp
+++ b/src/views/tooltips/tooltipmanager.cpp
@@ -48,17 +48,6 @@ ToolTipManager::ToolTipManager(QAbstractItemView* parent,
m_item(),
m_itemRect()
{
- static FileMetaDataToolTip* sharedToolTip = 0;
- if (!sharedToolTip) {
- sharedToolTip = new FileMetaDataToolTip();
- // TODO: Using K_GLOBAL_STATIC would be preferable to maintain the
- // instance, but the cleanup of KFileMetaDataWidget at this stage does
- // not work.
- }
- m_fileMetaDataToolTip = sharedToolTip;
- connect(m_fileMetaDataToolTip, SIGNAL(metaDataRequestFinished(KFileItemList)),
- this, SLOT(slotMetaDataRequestFinished()));
-
m_dolphinModel = static_cast<DolphinModel*>(m_proxyModel->sourceModel());
connect(parent, SIGNAL(entered(const QModelIndex&)),
this, SLOT(requestToolTip(const QModelIndex&)));
@@ -86,6 +75,7 @@ ToolTipManager::ToolTipManager(QAbstractItemView* parent,
connect(parent->verticalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(hideToolTip()));
+ Q_ASSERT(m_view);
m_view->viewport()->installEventFilter(this);
m_view->installEventFilter(this);
}
@@ -106,9 +96,9 @@ void ToolTipManager::hideToolTip()
m_showToolTipTimer->stop();
m_contentRetrievalTimer->stop();
- m_fileMetaDataToolTip->setItems(KFileItemList());
- m_fileMetaDataToolTip->hide();
-}
+ delete m_fileMetaDataToolTip;
+ m_fileMetaDataToolTip = 0;}
+
bool ToolTipManager::eventFilter(QObject* watched, QEvent* event)
{
@@ -145,6 +135,11 @@ void ToolTipManager::requestToolTip(const QModelIndex& index)
// Only start the retrieving of the content, when the mouse has been over this
// item for 200 milliseconds. This prevents a lot of useless preview jobs and
// meta data retrieval, when passing rapidly over a lot of items.
+ Q_ASSERT(!m_fileMetaDataToolTip);
+ m_fileMetaDataToolTip = new FileMetaDataToolTip(m_view);
+ connect(m_fileMetaDataToolTip, SIGNAL(metaDataRequestFinished(KFileItemList)),
+ this, SLOT(slotMetaDataRequestFinished()));
+
m_contentRetrievalTimer->start();
m_showToolTipTimer->start();
m_toolTipRequested = true;