'Qt: How to change cursor by using style sheets?
I know I can change the cursor by "setCursor(const QCursor &)"
.
Now I want to change it by using qss, but I don't know how to do it.
QWidget has the cursor property, so theoretically I can use "qproperty-cursor:PointingHandCursor"
to set cursor. But it doesn't work!
Does anyone know why "qproperty-cursor" doesn't work?
Solution 1:[1]
It cannot be done because QCursor
is not an enum but a class (of which each existing cursor like Qt::PointingHandCursor
is a global instantiation, the same as std::cout
is a global instantiation of std::ostream
), and there are no conversion available between a string and existing cursor instantiations.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |