[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bdigikam/development/2=2E0=5D_libs/widgets/common=3A?=
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2011-02-27 21:06:08
Message-ID: 20110227210608.7A267A60D5 () git ! kde ! org
[Download RAW message or body]

Git commit 1e6be2f9402900bb899a78f0c184155647ba4cfc by Marcel Wiesweg.
Committed on 27/02/2011 at 16:56.
Pushed by mwiesweg into branch 'development/2.0'.

Prepare view to allow for customization of showing tooltip (special tooltip for \
certain areas etc.)

M  +18   -12   libs/widgets/common/dcategorizedview.cpp     
M  +5    -0    libs/widgets/common/dcategorizedview.h     

http://commits.kde.org/digikam/1e6be2f9402900bb899a78f0c184155647ba4cfc

diff --git a/libs/widgets/common/dcategorizedview.cpp \
b/libs/widgets/common/dcategorizedview.cpp index 6968395..14edea8 100644
--- a/libs/widgets/common/dcategorizedview.cpp
+++ b/libs/widgets/common/dcategorizedview.cpp
@@ -603,6 +603,23 @@ void DCategorizedView::indexActivated(const QModelIndex&)
 {
 }
 
+bool DCategorizedView::showToolTip(QHelpEvent* he, const QModelIndex& index, \
QStyleOptionViewItem& option) +{
+    QRect innerRect;
+
+    if (d->delegate->acceptsToolTip(he->pos(), option.rect, index, &innerRect))
+    {
+        if (!innerRect.isNull())
+        {
+            option.rect = innerRect;
+        }
+
+        d->toolTip->show(he, option, index);
+        return true;
+    }
+    return false;
+}
+
 void DCategorizedView::contextMenuEvent(QContextMenuEvent* event)
 {
     userInteraction();
@@ -797,18 +814,7 @@ bool DCategorizedView::viewportEvent(QEvent* event)
             QStyleOptionViewItem option = viewOptions();
             option.rect = visualRect(index);
             option.state |= (index == currentIndex() ? QStyle::State_HasFocus : \
                QStyle::State_None);
-            QRect innerRect;
-
-            if (d->delegate->acceptsToolTip(he->pos(), option.rect, index, \
                &innerRect))
-            {
-                if (!innerRect.isNull())
-                {
-                    option.rect = innerRect;
-                }
-
-                d->toolTip->show(he, option, index);
-            }
-
+            showToolTip(he, index, option);
             return true;
         }
         default:
diff --git a/libs/widgets/common/dcategorizedview.h \
b/libs/widgets/common/dcategorizedview.h index a4e5a7f..ad2b078 100644
--- a/libs/widgets/common/dcategorizedview.h
+++ b/libs/widgets/common/dcategorizedview.h
@@ -128,6 +128,11 @@ protected:
     virtual void showContextMenu(QContextMenuEvent* event);
     virtual void indexActivated(const QModelIndex& index);
 
+    /** Provides default behavior, can reimplement in a subclass.
+     *  Returns true if a tooltip was shown.
+     */
+    virtual bool showToolTip(QHelpEvent* he, const QModelIndex& index, \
QStyleOptionViewItem& option); +
     /** Returns an index that is representative for the category at position pos */
     QModelIndex indexForCategoryAt(const QPoint& pos) const;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic