> Comments on the patch:
>  * You should make the timer single shot, no need to get the timer called
> again and again

Done.

>  * If when dragging happens the timer is still running (dragging happened
> earlier than Application::doubleClickInterval() + 10) you should stop the
> timer and call slotShowSizeAllCursor

And done.

Patch is attached.

Cheers,
Glen Kaukola
Index: okular/ui/pageview.cpp
===================================================================
--- okular/ui/pageview.cpp	(revision 1107483)
+++ okular/ui/pageview.cpp	(working copy)
@@ -145,6 +145,9 @@
     QPoint dragScrollVector;
     QTimer dragScrollTimer;
 
+    // left click depress
+    QTimer leftClickTimer;
+
     // actions
     KAction * aRotateClockwise;
     KAction * aRotateCounterClockwise;
@@ -303,6 +306,9 @@
     connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRequestVisiblePixmaps(int)));
     connect( &d->dragScrollTimer, SIGNAL(timeout()), this, SLOT(slotDragScroll()) );
 
+    d->leftClickTimer.setSingleShot( true );
+    connect( &d->leftClickTimer, SIGNAL(timeout()), this, SLOT(slotShowSizeAllCursor()) );
+
     // set a corner button to resize the view to the page size
 //    QPushButton * resizeButton = new QPushButton( viewport() );
 //    resizeButton->setPixmap( SmallIcon("crop") );
@@ -1466,6 +1472,8 @@
         case MouseNormal:
             if ( leftButton )
             {
+                d->leftClickTimer.stop();
+
                 if ( d->mouseAnn )
                 {
                     PageViewItem * pageItem = pickItemOnPoint( eventPos.x(), eventPos.y() );
@@ -1494,6 +1502,8 @@
                 // drag page
                 else if ( !d->mouseGrabPos.isNull() )
                 {
+                    setCursor( Qt::SizeAllCursor );
+
                     QPoint mousePos = e->globalPos();
                     QPoint delta = d->mouseGrabPos - mousePos;
 
@@ -1652,7 +1662,7 @@
                 {
                 d->mouseGrabPos = d->mouseOnRect ? QPoint() : d->mousePressPos;
                 if ( !d->mouseOnRect )
-                    setCursor( Qt::SizeAllCursor );
+                    d->leftClickTimer.start( QApplication::doubleClickInterval() + 10 );
                 }
             }
             else if ( rightButton )
@@ -1713,6 +1723,8 @@
     // stop the drag scrolling
     d->dragScrollTimer.stop();
 
+    d->leftClickTimer.stop();
+
     // don't perform any mouse action when no document is shown..
     if ( d->items.isEmpty() )
     {
@@ -3272,6 +3284,11 @@
     d->messageWindow->display( i18n( "Welcome" ), PageViewMessage::Info, 2000 );
 }
 
+void PageView::slotShowSizeAllCursor()
+{
+    setCursor( Qt::SizeAllCursor );
+}
+
 void PageView::slotZoom()
 {
     setFocus();
Index: okular/ui/pageview.h
===================================================================
--- okular/ui/pageview.h	(revision 1107483)
+++ okular/ui/pageview.h	(working copy)
@@ -190,6 +190,8 @@
         void slotDragScroll();
         // show the welcome message
         void slotShowWelcome();
+        // activated by left click timer
+        void slotShowSizeAllCursor();
 
         // connected to local actions (toolbar, menu, ..)
         void slotZoom();
_______________________________________________
Okular-devel mailing list
Okular-devel@kde.org
https://mail.kde.org/mailman/listinfo/okular-devel

Reply via email to