Summary: | Add a way for special configuration/mouse to resize thumbnails with an alternative to the middle button | ||
---|---|---|---|
Product: | [Applications] kphotoalbum | Reporter: | Baptiste MATHUS <ml> |
Component: | Thumbnail Viewer | Assignee: | Tuomas Suutari <tuomas> |
Status: | RESOLVED WORKSFORME | ||
Severity: | wishlist | CC: | kpabugs |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | All | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
This patch lets you use the classical way (Middle button) or Ctrl+Alt to resize thumbs
"Video" shot made with wink showing the pb with Ctrl-Wheel |
Description
Baptiste MATHUS
2007-05-08 22:55:56 UTC
Created attachment 20519 [details]
This patch lets you use the classical way (Middle button) or Ctrl+Alt to resize thumbs
A patch that added Ctrl+Shift+MouseButton for this operation was already applied. But it broke selection, so I changed it to Ctrl+Alt+MouseButton as you suggested. Using Ctrl+MouseWheel for resizing the thumbnails seems to be more "standard" way. If that's possible, it would be nice improvement too. So leaving this bug as open until that's implemented. SVN commit 665452 by suutari: Make it possible to resize thumbnails with Ctrl+MouseWheel too. CCBUG: 145207 M +29 -2 ThumbnailWidget.cpp M +3 -0 ThumbnailWidget.h --- trunk/extragear/graphics/kphotoalbum/ThumbnailView/ThumbnailWidget.cpp #665451:665452 @@ -51,6 +51,7 @@ ThumbnailView::ThumbnailWidget::ThumbnailWidget( QWidget* parent, const char* name ) :QGridView( parent, name ), _gridResizeInteraction( this ), + _wheelResizing( false ), _selectionInteraction( this ), _mouseTrackingHandler( this ), _mouseHandler( &_mouseTrackingHandler ), @@ -85,7 +86,7 @@ QPixmap doubleBuffer( cellRect().size() ); QPainter painter( &doubleBuffer ); paintCellBackground( &painter, row, col ); - if ( !_mouseHandler->isResizingGrid() ) { + if ( !_mouseHandler->isResizingGrid() && !_wheelResizing ) { paintCellPixmap( &painter, row, col ); paintCellText( &painter, row, col ); } @@ -454,7 +455,7 @@ else p->fillRect( rect, palette().active().base() ); - if (_mouseHandler->isResizingGrid() || + if (_mouseHandler->isResizingGrid() || _wheelResizing || Settings::SettingsData::instance()->thumbnailDisplayGrid()) { p->setPen( palette().active().dark() ); // left of frame @@ -508,6 +509,16 @@ possibleEmitSelectionChanged(); } +void ThumbnailView::ThumbnailWidget::keyReleaseEvent( QKeyEvent* event ) +{ + if ( _wheelResizing && event->key() == Qt::Key_Control ) { + _wheelResizing = false; + repaintScreen(); + } + else + QGridView::keyReleaseEvent(event); +} + void ThumbnailView::ThumbnailWidget::keyboardMoveEvent( QKeyEvent* event ) { static QString startPossition; @@ -664,8 +675,24 @@ } } +void ThumbnailView::ThumbnailWidget::wheelEvent( QWheelEvent* event ) +{ + if ( event->state() & ControlButton ) { + event->accept(); + _wheelResizing = true; + int delta = event->delta() / 20; + + Settings::SettingsData::instance()->setThumbSize( QMAX( 32, cellWidth() + delta ) ); + + updateCellSize(); + } + else + QGridView::wheelEvent(event); +} + + void ThumbnailView::ThumbnailWidget::emitDateChange( int x, int y ) { if ( _isSettingDate ) --- trunk/extragear/graphics/kphotoalbum/ThumbnailView/ThumbnailWidget.h #665451:665452 @@ -105,11 +105,13 @@ // event handlers virtual void keyPressEvent( QKeyEvent* ); + virtual void keyReleaseEvent( QKeyEvent* ); virtual void showEvent( QShowEvent* ); virtual void mousePressEvent( QMouseEvent* ); virtual void mouseMoveEvent( QMouseEvent* ); virtual void mouseReleaseEvent( QMouseEvent* ); virtual void mouseDoubleClickEvent ( QMouseEvent* ); + virtual void wheelEvent( QWheelEvent* ); virtual void resizeEvent( QResizeEvent* ); void keyboardMoveEvent( QKeyEvent* ); virtual void dimensionChange ( int oldNumRows, int oldNumCols ); @@ -188,6 +190,7 @@ ThumbnailToolTip* _toolTip; GridResizeInteraction _gridResizeInteraction; + bool _wheelResizing; SelectionInteraction _selectionInteraction; MouseTrackingInteraction _mouseTrackingHandler; MouseInteraction* _mouseHandler; *** Bug has been marked as fixed ***. The Ctrl+scroll seems to be buggy, at least for me. It doesn't refresh. It works fine with Middle button, or Ctrl-Alt. But ctrl-mousewheel, after releasing, eveything stays black. I made a quick "winkshot" if necessary. Created attachment 20634 [details]
"Video" shot made with wink showing the pb with Ctrl-Wheel
This short is composed of three parts, separated with "next" buttons:
* After the first one, resizing is shown to be working with Ctrl-Alt
* After the second one, resizing is shown to be working with Middle mouse
button
* After the third one, the bug with Ctrl-mousewheel is shown.
Hmm... I have no idea why it doesn't work with you. With my system it works just fine. Maybe there's something about Qt's event handling mechanism that I don't understand. The idea was to enable resizing mode with Ctrl+MouseWheel and keep it on until you release Ctrl. So it seems that your KPA doesn't get the Ctrl released event. This is how I use it: 1. Move mouse cursor over the thumbnail view 2. Press Ctrl 3. Scroll mouse wheel to resize 4. Release Ctrl Any difference in the way that you're using it? Does pressing/releasing Ctrl again help? I found why it wasn't working, though I don't know who's I should send the report: us or gnome mouse manager. I activated a feature associated to my mouse cursor. When I push Ctrl, a quickly "narrowing square" appears around my mouse pointer, it makes it a useful way to quickly find your cursor without shaking the mouse :-). If I disable this feature anyway, the feature is KPA works perfectly. Well, I just tested another thing that was't working (other than KPA) and it works now :-/. I guess I'm gonna have a report sent to the gnome-mouse-properties team :-). Sorry for that. (Marking the bug as resolved again, but I'm not sure I've the right to do that currently...). |