[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kde4/kdeaddons/konq-plugins/sidebar/newsticker
From: Joseph Wenninger <kde () jowenn ! at>
Date: 2005-06-20 15:58:00
Message-ID: 1119283080.237611.22483.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 427415 by jowenn:
port to new QToolTip API
M +22 -16 nspanel.cpp
M +3 -2 nspanel.h
--- branches/work/kde4/kdeaddons/konq-plugins/sidebar/newsticker/nspanel.cpp #427414:427415
@@ -30,8 +30,8 @@
#include <kdebug.h>
#include <klistbox.h>
#include "nspanel.h"
+#include <QEvent>
-
namespace KSB_News {
////////////////////////////////////////////////////////////////
@@ -45,25 +45,31 @@
KListBox::clear();
}
-/*
- void TTListBox::maybeTip(const QPoint &point) {
- Q3ListBoxItem *item = itemAt(point);
- if (item) {
- QString text = item->text();
- if (!text.isEmpty()) {
- // Show ToolTip only if necessary
- QFontMetrics fm(fontMetrics());
- int textWidth = fm.width(text);
- int widgetSpace = visibleWidth();
- if ((textWidth > widgetSpace) || (contentsX() > 0))
- tip(itemRect(item), text);
- }
- }
+
+ bool TTListBox::event(QEvent *e) {
+ if (e->type()==QEvent::ToolTip) {
+ QPoint point=mapFromGlobal(QCursor::pos());
+ Q3ListBoxItem *item = itemAt(point);
+ if (item) {
+ QString text = item->text();
+ if (!text.isEmpty()) {
+ // Show ToolTip only if necessary
+ QFontMetrics fm(fontMetrics());
+ int textWidth = fm.width(text);
+ int widgetSpace = visibleWidth();
+ if ((textWidth > widgetSpace) || (contentsX() > 0))
+ QToolTip::showText(QCursor::pos(), text);
+ e->accept();
+ return true;
+ }
+ else return false;
+ } else return false;
+ } else return KListBox::event(e);
}
-*/
+
NSPanel::NSPanel(QObject *parent, const char *name, const QString &key,
DCOPRef *rssservice)
:QObject(parent, name)
--- branches/work/kde4/kdeaddons/konq-plugins/sidebar/newsticker/nspanel.h #427414:427415
@@ -42,12 +42,13 @@
////////////////////////////////////////////////////////////////
// ListBox including ToolTip for item
////////////////////////////////////////////////////////////////
- class TTListBox : public KListBox/*, QToolTip*/ {
+ class TTListBox : public KListBox {
public:
TTListBox (QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0);
void clear();
- //protected:
+ protected:
+ bool event(QEvent* e);
// virtual void maybeTip(const QPoint &);
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic