From 6cec90cabb0ebd8755153aa708f12e0e56c5c6c6 Mon Sep 17 00:00:00 2001 From: Fawn Date: Tue, 28 Oct 2025 12:14:46 -0700 Subject: [PATCH] Use system cursors instead of embedded raster images where possible (#7838) Given these changes, the knife tool now uses `Qt::SplitHCursor`, but `Qt::IBeamCursor` is also a a viable option. I am noting this should substantial concern arise over the appearance of `Qt::SplitHCursor` due to cursor themes, such as the default one applied to applications running under WSL. --- data/themes/classic/cursor_knife.png | Bin 456 -> 0 bytes data/themes/classic/hand.png | Bin 760 -> 0 bytes data/themes/classic/style.css | 8 ------ data/themes/default/cursor_knife.png | Bin 243 -> 0 bytes data/themes/default/hand.png | Bin 348 -> 0 bytes data/themes/default/style.css | 8 ------ include/ClipView.h | 9 ------- .../AudioFileProcessorView.cpp | 2 +- plugins/GigPlayer/GigPlayer.cpp | 4 +-- plugins/Patman/Patman.cpp | 2 +- plugins/Sf2Player/Sf2Player.cpp | 4 +-- src/gui/AutomatableModelView.cpp | 2 +- src/gui/clips/ClipView.cpp | 23 ++++-------------- src/gui/tracks/FadeButton.cpp | 2 +- src/gui/tracks/TrackLabelButton.cpp | 2 +- src/gui/tracks/TrackOperationsWidget.cpp | 1 + 16 files changed, 15 insertions(+), 52 deletions(-) delete mode 100644 data/themes/classic/cursor_knife.png delete mode 100644 data/themes/classic/hand.png delete mode 100644 data/themes/default/cursor_knife.png delete mode 100644 data/themes/default/hand.png diff --git a/data/themes/classic/cursor_knife.png b/data/themes/classic/cursor_knife.png deleted file mode 100644 index 8ddbd3ac4e784f15adebb129f707fdcd68672257..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmV;(0XP1MP)6vy#zJhQVIJ7e$AN)Z#s;0R3N2yh6_kby8)O(llz8C&9R?5yZ@04hY<=1)yx z=_%10{QJmxiUAh%yrgf07-M=xNRlKHhGB0A*>1OzB#F?&=TMiI;cy6mF(&R3p>7+S z&4w@xJ42KJgTa9HdfgeK1n3&^BcMyfuYj%)e*(H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)q$DxI_qeDrHVX{Diun&{oFTo??%1n7u%$IdHd^&q#qI}Zv z0EK`V`8KmovCQ!LEVbx)kyZTpsg=d16VLN1&9_&-R`X6EaJhA8?H}e{;e+QM=jTRp$Tz diff --git a/data/themes/default/hand.png b/data/themes/default/hand.png deleted file mode 100644 index c6d9a07893df5646f0e74a4cc397c39203910229..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 348 zcmV-i0i*tjP)yAqZL;>i=kJE~qIeXjE(sf)f&%^T*eleBSlL`wlN{EmGu`c^n#=Dphh}oiiL7#}=vPNjW07Ibc*^ix6%{ zG+Mup@5eZ0lQq1k(NbQd@jPNBFOPK+?6A-m`CdetuSir6rr3rRA{^oCM6<>Z(#j&W z0%<&HyHd`0%S^jW`LF(m><{X&_YfBm(^GZTMA6q1258!i`6%+1Qlrl-IRL*uV;TKW zG07DG1Oj(?eob%iI# uMc4OMGm2wDI?{SjbF7A+j%E0000 x, height -> y - Q_PROPERTY( QSize mouseHotspotHand MEMBER m_mouseHotspotHand ) - Q_PROPERTY( QSize mouseHotspotKnife MEMBER m_mouseHotspotKnife ) public: const static int BORDER_WIDTH = 2; @@ -223,11 +219,6 @@ private: QColor m_patternClipBackground; bool m_gradient; QColor m_markerColor; - QSize m_mouseHotspotHand; // QSize must be used because QPoint - QSize m_mouseHotspotKnife; // isn't supported by property system - QCursor m_cursorHand; - QCursor m_cursorKnife; - bool m_cursorSetYet; bool m_needsUpdate; inline void setInitialPos( QPoint pos ) diff --git a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp index 6a809b31e..0658dc651 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp @@ -51,7 +51,7 @@ AudioFileProcessorView::AudioFileProcessorView(Instrument* instrument, InstrumentViewFixedSize(instrument, parent) { m_openAudioFileButton = new PixmapButton(this); - m_openAudioFileButton->setCursor(QCursor(Qt::PointingHandCursor)); + m_openAudioFileButton->setCursor(Qt::PointingHandCursor); m_openAudioFileButton->move(227, 72); m_openAudioFileButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap( "select_file")); diff --git a/plugins/GigPlayer/GigPlayer.cpp b/plugins/GigPlayer/GigPlayer.cpp index 859dd2773..19947eb17 100644 --- a/plugins/GigPlayer/GigPlayer.cpp +++ b/plugins/GigPlayer/GigPlayer.cpp @@ -914,7 +914,7 @@ GigInstrumentView::GigInstrumentView( Instrument * _instrument, QWidget * _paren // File Button m_fileDialogButton = new PixmapButton( this ); - m_fileDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) ); + m_fileDialogButton->setCursor(Qt::PointingHandCursor); m_fileDialogButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fileselect_on" ) ); m_fileDialogButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "fileselect_off" ) ); m_fileDialogButton->move( 223, 68 ); @@ -925,7 +925,7 @@ GigInstrumentView::GigInstrumentView( Instrument * _instrument, QWidget * _paren // Patch Button m_patchDialogButton = new PixmapButton( this ); - m_patchDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) ); + m_patchDialogButton->setCursor(Qt::PointingHandCursor); m_patchDialogButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "patches_on" ) ); m_patchDialogButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "patches_off" ) ); m_patchDialogButton->setEnabled( false ); diff --git a/plugins/Patman/Patman.cpp b/plugins/Patman/Patman.cpp index 7c2800287..589c3559f 100644 --- a/plugins/Patman/Patman.cpp +++ b/plugins/Patman/Patman.cpp @@ -442,7 +442,7 @@ PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) : m_openFileButton = new PixmapButton( this, nullptr ); m_openFileButton->setObjectName( "openFileButton" ); - m_openFileButton->setCursor( QCursor( Qt::PointingHandCursor ) ); + m_openFileButton->setCursor(Qt::PointingHandCursor); m_openFileButton->move( 227, 86 ); m_openFileButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "select_file_on" ) ); diff --git a/plugins/Sf2Player/Sf2Player.cpp b/plugins/Sf2Player/Sf2Player.cpp index 25e7b2f51..d50c7f7d4 100644 --- a/plugins/Sf2Player/Sf2Player.cpp +++ b/plugins/Sf2Player/Sf2Player.cpp @@ -963,7 +963,7 @@ Sf2InstrumentView::Sf2InstrumentView( Instrument * _instrument, QWidget * _paren // File Button m_fileDialogButton = new PixmapButton(this); - m_fileDialogButton->setCursor(QCursor(Qt::PointingHandCursor)); + m_fileDialogButton->setCursor(Qt::PointingHandCursor); m_fileDialogButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("fileselect_on")); m_fileDialogButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("fileselect_off")); m_fileDialogButton->move(217, 107); @@ -974,7 +974,7 @@ Sf2InstrumentView::Sf2InstrumentView( Instrument * _instrument, QWidget * _paren // Patch Button m_patchDialogButton = new PixmapButton(this); - m_patchDialogButton->setCursor(QCursor(Qt::PointingHandCursor)); + m_patchDialogButton->setCursor(Qt::PointingHandCursor); m_patchDialogButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("patches_on")); m_patchDialogButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("patches_off")); m_patchDialogButton->setEnabled(false); diff --git a/src/gui/AutomatableModelView.cpp b/src/gui/AutomatableModelView.cpp index 2faf74064..c52f9077c 100644 --- a/src/gui/AutomatableModelView.cpp +++ b/src/gui/AutomatableModelView.cpp @@ -49,7 +49,7 @@ AutomatableModelView::AutomatableModelView( Model* model, QWidget* _this ) : m_conversionFactor( 1.0 ) { widget()->setAcceptDrops( true ); - widget()->setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) ); + widget()->setCursor(Qt::PointingHandCursor); } void AutomatableModelView::addDefaultActions( QMenu* menu ) diff --git a/src/gui/clips/ClipView.cpp b/src/gui/clips/ClipView.cpp index 4b9d8dbc3..5e92e661f 100644 --- a/src/gui/clips/ClipView.cpp +++ b/src/gui/clips/ClipView.cpp @@ -96,11 +96,6 @@ ClipView::ClipView( Clip * clip, m_patternClipBackground( 0, 0, 0 ), m_gradient( true ), m_markerColor(0, 0, 0), - m_mouseHotspotHand( 0, 0 ), - m_mouseHotspotKnife( 0, 0 ), - m_cursorHand( QCursor( embed::getIconPixmap( "hand" ) ) ), - m_cursorKnife( QCursor( embed::getIconPixmap( "cursor_knife" ) ) ), - m_cursorSetYet( false ), m_needsUpdate( true ) { if( s_textFloat == nullptr ) @@ -111,7 +106,7 @@ ClipView::ClipView( Clip * clip, setAttribute( Qt::WA_DeleteOnClose, true ); setFocusPolicy( Qt::StrongFocus ); - setCursor( m_cursorHand ); + setCursor(Qt::PointingHandCursor); move( 0, 0 ); show(); @@ -167,14 +162,6 @@ ClipView::~ClipView() */ void ClipView::update() { - if( !m_cursorSetYet ) - { - m_cursorHand = QCursor( embed::getIconPixmap( "hand" ), m_mouseHotspotHand.width(), m_mouseHotspotHand.height() ); - m_cursorKnife = QCursor( embed::getIconPixmap( "cursor_knife" ), m_mouseHotspotKnife.width(), m_mouseHotspotKnife.height() ); - setCursor( m_cursorHand ); - m_cursorSetYet = true; - } - if( fixedClips() ) { updateLength(); @@ -504,10 +491,10 @@ void ClipView::updateCursor(QMouseEvent * me) // If we are in the middle on knife mode, use the knife cursor else if (m_trackView->trackContainerView()->knifeMode() && !isSelected()) { - setCursor(m_cursorKnife); + setCursor(Qt::SplitHCursor); } // If we are in the middle in any other mode, use the hand cursor - else { setCursor(m_cursorHand); } + else { setCursor(Qt::PointingHandCursor); } } @@ -681,7 +668,7 @@ void ClipView::mousePressEvent( QMouseEvent * me ) else if (knifeMode) { m_action = Action::Split; - setCursor( m_cursorKnife ); + setCursor(Qt::SplitHCursor); setMarkerPos( knifeMarkerPos( me ) ); setMarkerEnabled( true ); update(); @@ -996,7 +983,7 @@ void ClipView::mouseMoveEvent( QMouseEvent * me ) } else if( m_action == Action::Split ) { - setCursor(m_cursorKnife); + setCursor(Qt::SplitHCursor); setMarkerPos(knifeMarkerPos(me)); update(); } diff --git a/src/gui/tracks/FadeButton.cpp b/src/gui/tracks/FadeButton.cpp index 386b5be41..ae1df1eca 100644 --- a/src/gui/tracks/FadeButton.cpp +++ b/src/gui/tracks/FadeButton.cpp @@ -47,7 +47,7 @@ FadeButton::FadeButton(const QColor & _normal_color, m_activatedColor( _activated_color ), m_holdColor( holdColor ) { - setCursor(QCursor(embed::getIconPixmap("hand"), 3, 3)); + setCursor(Qt::PointingHandCursor); setFocusPolicy(Qt::NoFocus); activeNotes = 0; } diff --git a/src/gui/tracks/TrackLabelButton.cpp b/src/gui/tracks/TrackLabelButton.cpp index 88020b410..b8dcc333b 100644 --- a/src/gui/tracks/TrackLabelButton.cpp +++ b/src/gui/tracks/TrackLabelButton.cpp @@ -47,7 +47,7 @@ TrackLabelButton::TrackLabelButton( TrackView * _tv, QWidget * _parent ) : { setAcceptDrops( true ); setFocusPolicy(Qt::NoFocus); - setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) ); + setCursor(Qt::PointingHandCursor); setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); m_renameLineEdit = new TrackRenameLineEdit( this ); diff --git a/src/gui/tracks/TrackOperationsWidget.cpp b/src/gui/tracks/TrackOperationsWidget.cpp index 17144fdb6..d6ddc7027 100644 --- a/src/gui/tracks/TrackOperationsWidget.cpp +++ b/src/gui/tracks/TrackOperationsWidget.cpp @@ -90,6 +90,7 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) : m_trackOps->setFocusPolicy( Qt::NoFocus ); m_trackOps->setMenu( toMenu ); m_trackOps->setToolTip(tr("Actions")); + m_trackOps->setCursor(Qt::PointingHandCursor); m_muteBtn = new AutomatableButton(operationsWidget, tr("Mute")); m_muteBtn->setCheckable(true);