mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 05:40:59 +00:00
* draw cursor in the right shape (L_SHAPE, REVERSED_L_SHAPE or the normal one)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18645 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
53eb1f7518
commit
7429f0c2bf
@ -127,16 +127,44 @@ public:
|
|||||||
|
|
||||||
void draw(QPainter & painter)
|
void draw(QPainter & painter)
|
||||||
{
|
{
|
||||||
// FIXME: do something depending on the cursor shape.
|
if (show_ && rect_.isValid()) {
|
||||||
if (show_ && rect_.isValid())
|
switch (shape_) {
|
||||||
painter.fillRect(rect_, color_);
|
case L_SHAPE:
|
||||||
|
painter.fillRect(rect_.x(), rect_.y(), CursorWidth, rect_.height(), color_);
|
||||||
|
painter.setPen(color_);
|
||||||
|
painter.drawLine(rect_.bottomLeft().x() + CursorWidth, rect_.bottomLeft().y(),
|
||||||
|
rect_.bottomRight().x(), rect_.bottomLeft().y());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case REVERSED_L_SHAPE:
|
||||||
|
painter.fillRect(rect_.x() + rect_.height() / 3, rect_.y(), CursorWidth, rect_.height(), color_);
|
||||||
|
painter.setPen(color_);
|
||||||
|
painter.drawLine(rect_.bottomRight().x() - CursorWidth, rect_.bottomLeft().y(),
|
||||||
|
rect_.bottomLeft().x(), rect_.bottomLeft().y());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
painter.fillRect(rect_, color_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(int x, int y, int h, CursorShape shape)
|
void update(int x, int y, int h, CursorShape shape)
|
||||||
{
|
{
|
||||||
color_ = guiApp->colorCache().get(Color::cursor);
|
color_ = guiApp->colorCache().get(Color::cursor);
|
||||||
rect_ = QRect(x, y, CursorWidth, h);
|
|
||||||
shape_ = shape;
|
shape_ = shape;
|
||||||
|
switch (shape) {
|
||||||
|
case L_SHAPE:
|
||||||
|
rect_ = QRect(x, y, CursorWidth + h / 3, h);
|
||||||
|
break;
|
||||||
|
case REVERSED_L_SHAPE:
|
||||||
|
rect_ = QRect(x - h / 3, y, CursorWidth + h / 3, h);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rect_ = QRect(x, y, CursorWidth, h);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void show(bool set_show = true) { show_ = set_show; }
|
void show(bool set_show = true) { show_ = set_show; }
|
||||||
|
Loading…
Reference in New Issue
Block a user