Fix hover handling in the timeline
This commit is contained in:
parent
0d61f4bff1
commit
d43607d01c
16 changed files with 127 additions and 67 deletions
25
src/ui/NhekoCursorShape.cpp
Normal file
25
src/ui/NhekoCursorShape.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "NhekoCursorShape.h"
|
||||
|
||||
#include <QCursor>
|
||||
|
||||
NhekoCursorShape::NhekoCursorShape(QQuickItem *parent)
|
||||
: QQuickItem(parent)
|
||||
, currentShape_(Qt::CursorShape::ArrowCursor)
|
||||
{}
|
||||
|
||||
Qt::CursorShape
|
||||
NhekoCursorShape::cursorShape() const
|
||||
{
|
||||
return cursor().shape();
|
||||
}
|
||||
|
||||
void
|
||||
NhekoCursorShape::setCursorShape(Qt::CursorShape cursorShape)
|
||||
{
|
||||
if (currentShape_ == cursorShape)
|
||||
return;
|
||||
|
||||
currentShape_ = cursorShape;
|
||||
setCursor(cursorShape);
|
||||
emit cursorShapeChanged();
|
||||
}
|
||||
26
src/ui/NhekoCursorShape.h
Normal file
26
src/ui/NhekoCursorShape.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
// see
|
||||
// https://stackoverflow.com/questions/27821054/how-to-change-cursor-shape-in-qml-when-mousearea-is-covered-with-another-mousear/29382092#29382092
|
||||
|
||||
#include <QQuickItem>
|
||||
|
||||
class NhekoCursorShape : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape NOTIFY
|
||||
cursorShapeChanged)
|
||||
|
||||
public:
|
||||
explicit NhekoCursorShape(QQuickItem *parent = 0);
|
||||
|
||||
private:
|
||||
Qt::CursorShape cursorShape() const;
|
||||
void setCursorShape(Qt::CursorShape cursorShape);
|
||||
|
||||
Qt::CursorShape currentShape_;
|
||||
|
||||
signals:
|
||||
void cursorShapeChanged();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue