Re: [Okular-devel] pan mouse icon fix
A Dijous, 25 de març de 2010, Glen Kaukola va escriure: Hey, Here's the fix for the pan icon showing up on a double click. Seems to me the timer may last a bit too long though. Yeah? No? Anyway, criticism is certainly appreciated. Comments on the patch: * You should make the timer single shot, no need to get the timer called again and again * If when dragging happens the timer is still running (dragging happened earlier than Application::doubleClickInterval() + 10) you should stop the timer and call slotShowSizeAllCursor I also noticed what seems to be a bug with pop up notes. When my zoom is at 100% the whole of my document fits in the window. Great. Pop up notes seem to behave normally. However if I'm zoomed in enough that I'm able to scroll around in my document (or perhaps if a document just has more than one page), that's when I see a problem. If I open a pop up note and move it around a bit, I get this strangeness: http://www.cs.ucr.edu/~gkaukola/okularbug.png I'll see if I can't pin things down further. nice one :D Albert Cheers, Glen Kaukola ___ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel
Re: [Okular-devel] pan mouse icon fix
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 KaukolaIndex: 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
Re: [Okular-devel] pan mouse icon fix
A Dijous, 25 de març de 2010, Glen Kaukola va escriure: 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. Commited, thanks, do you continue with https://bugs.kde.org/show_bug.cgi?id=228551 ? Albert Cheers, Glen Kaukola ___ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel
[Okular-devel] pan mouse icon fix
Hey, Here's the fix for the pan icon showing up on a double click. Seems to me the timer may last a bit too long though. Yeah? No? Anyway, criticism is certainly appreciated. I also noticed what seems to be a bug with pop up notes. When my zoom is at 100% the whole of my document fits in the window. Great. Pop up notes seem to behave normally. However if I'm zoomed in enough that I'm able to scroll around in my document (or perhaps if a document just has more than one page), that's when I see a problem. If I open a pop up note and move it around a bit, I get this strangeness: http://www.cs.ucr.edu/~gkaukola/okularbug.png I'll see if I can't pin things down further. Cheers, Glen KaukolaIndex: okular/ui/pageview.cpp === --- okular/ui/pageview.cpp (revision 1107218) +++ okular/ui/pageview.cpp (working copy) @@ -145,6 +145,9 @@ QPoint dragScrollVector; QTimer dragScrollTimer; +// left click depress +QTimer leftClickTimer; + // actions KAction * aRotateClockwise; KAction * aRotateCounterClockwise; @@ -302,6 +305,7 @@ connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRequestVisiblePixmaps(int))); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRequestVisiblePixmaps(int))); connect( d-dragScrollTimer, SIGNAL(timeout()), this, SLOT(slotDragScroll()) ); +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() ); @@ -1652,7 +1656,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 +1717,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 +3278,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 1107218) +++ 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