Hide cursor while dragging.

This commit is contained in:
Leonardo Zide 2020-12-06 11:15:23 -08:00
parent b981de80c5
commit c6c0718d18
3 changed files with 16 additions and 8 deletions

View file

@ -58,6 +58,9 @@ void lcGLWidget::Redraw()
lcCursor lcGLWidget::GetCursor() const
{
if (mTrackButton != lcTrackButton::None)
return lcCursor::Hidden;
if (mTrackTool == lcTrackTool::Select)
{
if (mMouseModifiers & Qt::ControlModifier)
@ -122,6 +125,7 @@ void lcGLWidget::SetCursor(lcCursor CursorType)
const lcCursorInfo Cursors[static_cast<int>(lcCursor::Count)] =
{
{ 0, 0, "" }, // lcCursor::Hidden
{ 0, 0, "" }, // lcCursor::Default
{ 8, 3, ":/resources/cursor_insert" }, // lcCursor::Brick
{ 15, 15, ":/resources/cursor_light" }, // lcCursor::Light
@ -146,7 +150,12 @@ void lcGLWidget::SetCursor(lcCursor CursorType)
static_assert(LC_ARRAY_COUNT(Cursors) == static_cast<int>(lcCursor::Count), "Array size mismatch");
if (CursorType > lcCursor::Default && CursorType < lcCursor::Count)
if (CursorType == lcCursor::Hidden)
{
mWidget->setCursor(Qt::BlankCursor);
mCursor = CursorType;
}
else if (CursorType >= lcCursor::First && CursorType < lcCursor::Count)
{
const lcCursorInfo& Cursor = Cursors[static_cast<int>(CursorType)];
mWidget->setCursor(QCursor(QPixmap(Cursor.Name), Cursor.x, Cursor.y));

View file

@ -12,6 +12,8 @@ enum class lcDragState
enum class lcCursor
{
First,
Hidden = First,
Default,
Brick,
Light,

View file

@ -2277,14 +2277,11 @@ void View::UpdateTrackTool()
break;
}
if (NewTrackTool != mTrackTool)
{
mTrackTool = NewTrackTool;
UpdateCursor();
if (Redraw)
gMainWindow->UpdateAllViews();
}
}
bool View::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const