Commit 934fd4db authored by Aurélien Gâteau's avatar Aurélien Gâteau

Use a red cross cursor

parent 795a93b0
......@@ -69,6 +69,7 @@ static const int MEDIUM2_TICK_SIZE = 15;
static const int LARGE_TICK_SIZE = 18;
static const int THICKNESS = 70;
static const int CURSOR_SIZE = 15; // Must be an odd number
/**
* create the thingy with no borders and set up
......@@ -118,6 +119,8 @@ KLineal::KLineal( QWidget *parent )
resize( QSize( THICKNESS, len ) );
}
createCrossCursor();
//BEGIN setup menu and actions
mActionCollection = new KActionCollection( this );
mActionCollection->setConfigGroup( QStringLiteral( "Actions" ) );
......@@ -189,6 +192,20 @@ KLineal::~KLineal()
delete mTrayIcon;
}
void KLineal::createCrossCursor()
{
QPixmap pix( CURSOR_SIZE, CURSOR_SIZE );
int halfSize = CURSOR_SIZE / 2;
{
pix.fill( Qt::transparent );
QPainter painter( &pix );
painter.setPen( Qt::red );
painter.drawLine( 0, halfSize, CURSOR_SIZE - 1, halfSize );
painter.drawLine( halfSize, 0, halfSize, CURSOR_SIZE - 1 );
}
mCrossCursor = QCursor( pix, halfSize, halfSize );
}
void KLineal::createSystemTray()
{
mCloseAction = mActionCollection->addAction( KStandardAction::Close, this, SLOT(slotClose()) );
......@@ -628,7 +645,7 @@ void KLineal::mouseMoveEvent( QMouseEvent *inEvent )
if ( beginRect().contains( cpos ) || endRect().contains( cpos) ) {
setCursor( resizeCursor() );
} else {
setCursor( Qt::SizeAllCursor );
setCursor( mCrossCursor );
}
adjustLabel();
}
......
......@@ -54,6 +54,7 @@ protected:
void createSystemTray();
private:
void createCrossCursor();
QAction* addAction( QMenu *menu, const QIcon& icon, const QString& text,
const QObject* receiver, const char* member,
const QKeySequence &shortcut, const QString& name );
......@@ -78,6 +79,7 @@ private:
StateBegin,
StateEnd
};
QCursor mCrossCursor;
RulerState mRulerState;
QPoint mLastClickPos;
QPoint mDragOffset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment