86 lines
2.7 KiB
Plaintext
86 lines
2.7 KiB
Plaintext
/*!
|
|
\headerfile QskControl.h
|
|
\brief Base class of all Qsk controls
|
|
|
|
QskControl is the base class for most visible Qsk controls.
|
|
|
|
It re-establishes several concepts known from QWidget, that got lost
|
|
with QQuickItem:
|
|
|
|
- contentsRect()
|
|
- autoFillBackground()
|
|
- support of layout rules: sizeHint(), sizePolicy()
|
|
- font, palette, locale and their propagation on the item tree
|
|
|
|
Even if QQuickItem is part of the public C++ API it has obviously been
|
|
designed for implementing custom items, but not for using them in C++
|
|
code. To support this use case a lot of trivial methods have been added.
|
|
|
|
For some reason the QQuick classes introduced proprietory notfier hooks
|
|
instead of using the well established and powerful concept of events.
|
|
QskControl tries to revert this decision by mapping notifications
|
|
to events, when possible.
|
|
|
|
The following events are currently implemented:
|
|
|
|
- QEvent::FontChange
|
|
- QEvent::PaletteChange
|
|
- QEvent::LocaleChange
|
|
- QEvent::LayoutDirectionChange
|
|
- QEvent::ContentsRectChange
|
|
- QEvent::LayoutRequest
|
|
*/
|
|
|
|
class QskControl
|
|
{
|
|
public:
|
|
/*!
|
|
\fn float metric( QskAspect::Aspect aspect ) const
|
|
|
|
A convenience method equivalent to skinHint( aspect ).metric. The
|
|
QskSkinHint::TypeMask is set to QskSkinHint::Metric.
|
|
*/
|
|
|
|
/*!
|
|
\fn void setSkinlet( QskSkinlet* skinlet )
|
|
|
|
Allows overriding the QskControl::Skin used by this control to render its
|
|
contents.
|
|
|
|
*/
|
|
|
|
/*!
|
|
\fn const QskSkinlet* skinlet() const;
|
|
|
|
\return Skinlet assigned by setSkinlet().
|
|
\sa effectiveSkinlet()
|
|
*/
|
|
|
|
/*!
|
|
\fn QskSkinHint skinHint( QskAspect::Aspect aspect ) const
|
|
|
|
Returns the QskSkinHint value for a QskAspect::Aspect. If none is set for
|
|
this control, the value for QskSkin::skinHint() is returned.
|
|
|
|
\note If a QskSkinHintProvider is animating the color when called, the returned
|
|
value will be the current value, not the target value, unless a state mask
|
|
is requested as part of the aspect.
|
|
|
|
\param aspect Aspect
|
|
*/
|
|
|
|
/*!
|
|
\fn void updateNode( QSGNode* parentNode )
|
|
|
|
This method replaces the QQuickItem::updatePaintNode method as the
|
|
preferred paint method to override when subclassing QskControl. This allows
|
|
QskControl to perform some additional steps before calling updateNode(),
|
|
and provides a consistent parent node which subclasses can rely on.
|
|
|
|
Subclasses should call their Skin's updateNode() method inside this method.
|
|
|
|
\param parentNode The parent of the nodes to be added in this method.
|
|
\return The parent node.
|
|
*/
|
|
};
|