Skip to content

Commit

Permalink
Normalize cursor size
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 5, 2018
1 parent 333347b commit 337cc70
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,17 @@ QCursor QgsApplication::getThemeCursor( const Cursor &cursor )
Q_ASSERT( ! name.isEmpty( ) );

QIcon icon = getThemeIcon( QStringLiteral( "cursors" ) + QDir::separator() + name );
QCursor _cursor;
QCursor cursorIcon;
// Check if an icon exists for this cursor (the O.S. default cursor will be used if it does not)
if ( ! icon.isNull( ) )
{
// Apply scaling
float scale( ( float ) app->fontMetrics().height() / 32 * 1.5 ) ; // Make them bigger to match 24x24
_cursor = QCursor( icon.pixmap( std::ceil( scale * 32 ), std::ceil( scale * 32 ) ), std::ceil( scale * activeX ), std::ceil( scale * activeY ) );
float scale = app->fontMetrics().height() / 32.0;
cursorIcon = QCursor( icon.pixmap( std::ceil( scale * 32 ), std::ceil( scale * 32 ) ), std::ceil( scale * activeX ), std::ceil( scale * activeY ) );
}
if ( app )
app->mCursorCache.insert( cursor, _cursor );
return _cursor;
app->mCursorCache.insert( cursor, cursorIcon );
return cursorIcon;
}

// TODO: add some caching mechanism ?
Expand Down

0 comments on commit 337cc70

Please sign in to comment.