Update built-in cursors. (#246)

- Not all Qt::CursorShapes are supported on all platforoms
   - e.g. on Wayland (Ubuntu 24.04) Qt::SizeAllCursor is not available and
     falls back to its arrow cursor
   - added built-in Crosshair and Move cursors, so that they should be available
     across all platforms
- Redesigned existing object creation cursors
   - Crosshairs are now 3-pixels wide
   - Added white outlines to all cursors to aid in visibility against diverse
     backgrounds
This commit is contained in:
Jaye Evins
2025-11-05 14:29:15 -05:00
committed by GitHub
parent 8c8e447336
commit e6e08872e0
12 changed files with 32 additions and 2 deletions
+14
View File
@@ -26,6 +26,20 @@
namespace glabels namespace glabels
{ {
Cursors::Crosshair::Crosshair()
: QCursor( QPixmap(":cursors/32x32/cursor_crosshair.png"), 15, 15 )
{
// empty
}
Cursors::Move::Move()
: QCursor( QPixmap(":cursors/32x32/cursor_move.png"), 15, 15 )
{
// empty
}
Cursors::Barcode::Barcode() Cursors::Barcode::Barcode()
: QCursor( QPixmap(":cursors/32x32/cursor_barcode.png"), 7, 7 ) : QCursor( QPixmap(":cursors/32x32/cursor_barcode.png"), 7, 7 )
{ {
+14
View File
@@ -35,6 +35,20 @@ namespace glabels
{ {
class Crosshair : public QCursor
{
public:
Crosshair();
};
class Move : public QCursor
{
public:
Move();
};
class Barcode : public QCursor class Barcode : public QCursor
{ {
public: public:
+2 -2
View File
@@ -635,11 +635,11 @@ namespace glabels
if ( mModel->isSelectionAtomic() && if ( mModel->isSelectionAtomic() &&
!mModel->handleAt( mScale, xWorld, yWorld ).isNull() ) !mModel->handleAt( mScale, xWorld, yWorld ).isNull() )
{ {
setCursor( Qt::CrossCursor ); setCursor( Cursors::Crosshair() );
} }
else if ( mModel->objectAt( mScale, xWorld, yWorld ) ) else if ( mModel->objectAt( mScale, xWorld, yWorld ) )
{ {
setCursor( Qt::SizeAllCursor ); setCursor( Cursors::Move() );
} }
else else
{ {
+2
View File
@@ -4,9 +4,11 @@
<qresource> <qresource>
<file>cursors/32x32/cursor_barcode.png</file> <file>cursors/32x32/cursor_barcode.png</file>
<file>cursors/32x32/cursor_box.png</file> <file>cursors/32x32/cursor_box.png</file>
<file>cursors/32x32/cursor_crosshair.png</file>
<file>cursors/32x32/cursor_ellipse.png</file> <file>cursors/32x32/cursor_ellipse.png</file>
<file>cursors/32x32/cursor_image.png</file> <file>cursors/32x32/cursor_image.png</file>
<file>cursors/32x32/cursor_line.png</file> <file>cursors/32x32/cursor_line.png</file>
<file>cursors/32x32/cursor_move.png</file>
<file>cursors/32x32/cursor_text.png</file> <file>cursors/32x32/cursor_text.png</file>
</qresource> </qresource>
</RCC> </RCC>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 560 B