┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-10-06 14:42:48 +0000
committerPeter Penz <[email protected]>2010-10-06 14:42:48 +0000
commitec861fd2690007ed996138f3d845f507c721f4af (patch)
treeec6468a812d0ea7dba2d8b2f75e338a874d671f2 /src
parente2b844437e9308a04ddf043ae9d2f5c8ffef97b0 (diff)
Apply the cursor asynchronously. This fixes the issue that a pointing-hand cursor is shown if the selection-toggle and the item are hovered at the same time.
svn path=/trunk/KDE/kdebase/apps/; revision=1183214
Diffstat (limited to 'src')
-rw-r--r--src/views/selectiontoggle.cpp24
-rw-r--r--src/views/selectiontoggle.h3
2 files changed, 25 insertions, 2 deletions
diff --git a/src/views/selectiontoggle.cpp b/src/views/selectiontoggle.cpp
index 3ab40ebdc..cbd273b11 100644
--- a/src/views/selectiontoggle.cpp
+++ b/src/views/selectiontoggle.cpp
@@ -135,8 +135,16 @@ void SelectionToggle::enterEvent(QEvent* event)
QAbstractButton::enterEvent(event);
if (!m_appliedArrowCursor) {
- QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
m_appliedArrowCursor = true;
+ // Apply the arrow asynchronously. This is required for
+ // the following usecase:
+ // 1. Cursor is above the viewport left beside an item
+ // 2. Cursor is moved above the item, so that the selection-toggle
+ // and the item are entered equally.
+ // In this situation it is not defined who gets the enter-event first.
+ // As the selection-toggle is above the item, it should overwrite possible
+ // cursor changes done by the item.
+ QTimer::singleShot(0, this, SLOT(applyArrowCursor()));
}
// if the mouse cursor is above the selection toggle, display
@@ -156,8 +164,10 @@ void SelectionToggle::leaveEvent(QEvent* event)
QAbstractButton::leaveEvent(event);
if (m_appliedArrowCursor) {
- QApplication::restoreOverrideCursor();
+ // Reset the cursor asynchronously. See SelectionToggle::enterEvent()
+ // for a more information.
m_appliedArrowCursor = false;
+ QTimer::singleShot(0, this, SLOT(restoreCursor()));
}
m_isHovered = false;
@@ -235,6 +245,16 @@ void SelectionToggle::refreshIcon()
setIconOverlay(isChecked());
}
+void SelectionToggle::applyArrowCursor()
+{
+ QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+}
+
+void SelectionToggle::restoreCursor()
+{
+ QApplication::restoreOverrideCursor();
+}
+
void SelectionToggle::startFading()
{
Q_ASSERT(m_fadingTimeLine == 0);
diff --git a/src/views/selectiontoggle.h b/src/views/selectiontoggle.h
index 79833a522..26aa30050 100644
--- a/src/views/selectiontoggle.h
+++ b/src/views/selectiontoggle.h
@@ -82,6 +82,9 @@ private slots:
void setIconOverlay(bool checked);
void refreshIcon();
+ void applyArrowCursor();
+ void restoreCursor();
+
private:
void startFading();
void stopFading();