summaryrefslogtreecommitdiffstats
path: root/ksysv/kdltooltip.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit37333bf25ad9a4c538250f5af2f9f1d666362883 (patch)
treec45e8df5b9efbffe07eb3d9340df7811c7e16943 /ksysv/kdltooltip.cpp
downloadtdeadmin-37333bf25ad9a4c538250f5af2f9f1d666362883.tar.gz
tdeadmin-37333bf25ad9a4c538250f5af2f9f1d666362883.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksysv/kdltooltip.cpp')
-rw-r--r--ksysv/kdltooltip.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/ksysv/kdltooltip.cpp b/ksysv/kdltooltip.cpp
new file mode 100644
index 0000000..a0947ce
--- /dev/null
+++ b/ksysv/kdltooltip.cpp
@@ -0,0 +1,95 @@
+/***************************************************************************
+ begin : Tue Oct 5 1999
+ copyright : (C) 1999 by Peter Putzer
+ email : putzer@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2. *
+ * *
+ ***************************************************************************/
+
+#include <qrect.h>
+#include <qscrollbar.h>
+#include <qheader.h>
+
+#include <kdebug.h>
+
+#include "ksvdraglist.h"
+#include "kdltooltip.h"
+
+KDLToolTip::KDLToolTip (KSVDragList *parent, QToolTipGroup* group)
+ : QToolTip(parent, group),
+ mParent (parent)
+{
+}
+
+KDLToolTip::~KDLToolTip()
+{
+}
+
+void KDLToolTip::maybeTip (const QPoint& p)
+{
+ if (!mParent->displayToolTips())
+ return;
+
+ QString text;
+ QRect rect;
+
+ const QRect vert = mParent->verticalScrollBar()->geometry();
+ const QRect horiz = mParent->horizontalScrollBar()->geometry();
+
+ if (vert.contains(p))
+ {
+ rect = vert;
+
+ if (!mParent->commonToolTips())
+ text = mParent->verticalScrollBarTip();
+ else
+ text = mParent->tooltip();
+ }
+ else if (horiz.contains(p))
+ {
+ rect = horiz;
+ if (!mParent->commonToolTips())
+ text = mParent->horizontalScrollBarTip();
+ else
+ text = mParent->tooltip();
+
+ }
+ else
+ {
+ QPoint rp = mParent->viewport()->mapFromParent (p);
+ QListViewItem* i = mParent->itemAt (rp);
+ KSVItem* item = static_cast<KSVItem*> (i);
+
+ rect = mParent->header()->geometry();
+ if (rect.contains (p))
+ {
+ text = mParent->tooltip();
+ }
+ else if (item)
+ {
+ rect = mParent->itemRect (i);
+ rect.moveTopLeft (mParent->viewport()->mapToParent (rect.topLeft()));
+
+ text = item->tooltip();
+ }
+ else
+ {
+ rect = mParent->rect();
+
+ QListViewItem* last = mParent->lastItem();
+ if (last)
+ rect.setTop (mParent->viewport()->mapToParent (mParent->itemRect(last).bottomRight()).y());
+
+ text = mParent->tooltip();
+ }
+ }
+
+ if (!text.isEmpty())
+ tip (rect, text);
+}