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.
This commit is contained in:
Fawn
2025-10-28 12:14:46 -07:00
committed by GitHub
parent b1e6d180c7
commit 6cec90cabb
16 changed files with 15 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

View File

@@ -734,10 +734,6 @@ lmms--gui--TimeLineWidget {
qproperty-barLineColor: rgb( 192, 192, 192 );
qproperty-barNumberColor: rgb( 192, 192, 192 );
/* Cursor hotspots for loop marker adjustment */
qproperty-mouseHotspotSelLeft: 0px 16px;
qproperty-mouseHotspotSelRight: 32px 16px;
}
QTreeView {
@@ -762,10 +758,6 @@ lmms--gui--ClipView {
qproperty-textShadowColor: rgb( 0, 0, 0 );
qproperty-gradient: true; /* boolean property, set true to have a gradient */
qproperty-markerColor: rgb(0, 0, 0);
/* finger tip offset of cursor */
qproperty-mouseHotspotHand: 3px 3px;
qproperty-mouseHotspotKnife: 0px 0px;
font-size: 11px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

View File

@@ -799,10 +799,6 @@ lmms--gui--TimeLineWidget {
qproperty-barLineColor: rgb( 192, 192, 192 );
qproperty-barNumberColor: rgb( 192, 192, 192 );
/* Cursor hotspots for loop marker adjustment */
qproperty-mouseHotspotSelLeft: 0px 16px;
qproperty-mouseHotspotSelRight: 32px 16px;
}
lmms--gui--TrackContainerView QLabel
@@ -823,10 +819,6 @@ lmms--gui--ClipView {
qproperty-textShadowColor: rgba(0,0,0,200);
qproperty-gradient: false; /* boolean property, set true to have a gradient */
qproperty-markerColor: rgb(0, 0, 0);
/* finger tip offset of cursor */
qproperty-mouseHotspotHand: 7px 2px;
qproperty-mouseHotspotKnife: 0px 0px;
font-size: 11px;
}

View File

@@ -62,10 +62,6 @@ class ClipView : public selectableObject, public ModelView
Q_PROPERTY( QColor patternClipBackground READ patternClipBackground WRITE setPatternClipBackground )
Q_PROPERTY( bool gradient READ gradient WRITE setGradient )
Q_PROPERTY(QColor markerColor READ markerColor WRITE setMarkerColor)
// We have to use a QSize here because using QPoint isn't supported.
// width -> 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 )

View File

@@ -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"));

View File

@@ -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 );

View File

@@ -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" ) );

View File

@@ -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);

View File

@@ -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 )

View File

@@ -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();
}

View File

@@ -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;
}

View File

@@ -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 );

View File

@@ -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);