qskinny/doc/classes/QskAspect.dox

592 lines
14 KiB
Plaintext
Raw Normal View History

2017-07-21 18:21:34 +02:00
/*!
2021-01-25 11:06:01 +01:00
\class QskAspect QskAspect.h
2021-04-23 15:15:18 +02:00
\ingroup Themeing
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
\brief Lookup key for a QskSkinHintTable
2017-07-21 18:21:34 +02:00
2021-12-14 08:45:49 +01:00
QskAspect is used by the \ref qskskinning "themeing system" to determine a
a certain aspect of a QskSkinnable. While an aspect is simply a 64-bit
2021-04-29 17:48:15 +02:00
unsigned integer, it is composed of smaller enum bitfields which can be ORed
together to describe a more specific part of the user interface.
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
For example, the border colors of a QskPushButton while pressed is
2017-07-21 18:21:34 +02:00
defined by combining the State (QskAbstractButton::Pressed) with the
2021-04-29 17:48:15 +02:00
Subcontrol (QskPushButton::Panel), the Primitive (QskAspect::Border),
and the Type (QskAspect::Color) as so:
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
auto aspect = QskPushButton::Panel | QskAbstractButton::Pressed | QskAspect::Color | QskAspect::Border
2017-07-21 18:21:34 +02:00
2021-04-23 15:15:18 +02:00
\sa QskSkinnable::effectiveSkinHint(), QskSkinHintTable
*/
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
/*!
\enum QskAspect::Type
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
\brief Represents the type of the Aspect.
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
The type categorizes the aspect to be a metric, color or "something else".
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
Often primitives are related to a specific category. F.e QskAspect::Alignment will
probably always be a QskAspect::Flag, while QskAspect::Border will usually
be combined with QskAspect::Color and QskAspect::Metric.
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
Smooth transitions can be set up depending on these categories. F.e when
changing from daylight to darkness color schemem only values of QskAspect::Color
aspects need to be considered. But when changing the Look&Feel of the
application all type of aspects need to be considered.
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
\var QskAspect::Type QskAspect::Flag
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
Flags are all sort of attributes that are no metrics or colors - f.e
2021-04-28 09:32:49 +02:00
an alignment.
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
\var QskAspect::Type QskAspect::Metric
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
Metrics are related to geometries in most cases corresponding to pixel distances.
2021-04-28 09:32:49 +02:00
Examples are margin/padding(s).
2017-07-21 18:21:34 +02:00
2021-01-25 11:06:01 +01:00
\var QskAspect::Type QskAspect::Color
Colors are all sort of color values, like fill gradients, border colors.
*/
/*!
2021-04-28 09:32:49 +02:00
\enum QskAspect::Primitive
2021-01-25 11:06:01 +01:00
2021-04-29 17:48:15 +02:00
\brief Represents a specific element or attribute
This enum defines an initial list of primitive elements. A primitive is a common
element, such as a border, font role etc.
The number of primitives can be extended by additional application
specific elements by using reservePrimitives()
2021-04-28 09:32:49 +02:00
\sa setPrimitive(), clearPrimitive(), primitive(),
reservePrimitives(), primitiveCount()
2021-04-23 15:15:18 +02:00
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::NoPrimitive
2021-04-29 17:48:15 +02:00
No specific primitive
2017-07-21 18:21:34 +02:00
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Alignment
2021-04-29 17:48:15 +02:00
Usually used in combination with QskAspect::Flag
2021-01-25 11:06:01 +01:00
2021-04-29 17:48:15 +02:00
\sa QskSkinnable::alignmentHint(), QskSkinHintTableEditor::alignment()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Style
Usually used in combination with QskAspect::Flag
\var QskAspect::Primitive QskAspect::GraphicRole
2021-04-29 17:48:15 +02:00
A graphic role is an id that can be used to retrieve a specific
color filter for a graphic.
\sa QskSkinnable::graphicRoleHint(), QskSkinHintTableEditor::graphicRole(),
QskSkin::graphicFilter(), QskSkinnable::effectiveGraphicFilter()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::FontRole
2021-04-29 17:48:15 +02:00
A font role is an id that can be used to retrieve a specific
font from the font table.
\sa QskSkinnable::fontRoleHint(), QskSkinHintTableEditor::fontRole()
QskSkin::font(), QskSkinnable::effectiveFont()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::TextColor
2021-04-29 17:48:15 +02:00
A color for regular text
\sa QskTextColors(), QskAspect::StyleColor, QskAspect::LinkColor
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::StyleColor
2021-04-29 17:48:15 +02:00
This color is used as the outline color for outlined text,
and as the shadow color for raised or sunken text.
\sa QskAspect::TextColor, QskAspect::LinkColor
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::LinkColor
2021-04-29 17:48:15 +02:00
The color of links in texts.
\sa QskAspect::TextColor, QskAspect::StyleColor
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::StrutSize
2021-04-29 17:48:15 +02:00
A sensible metric - usually a QSizeF.
This size is usually used for layout calculations. It might be
interpreted as a minimum, maximum or fixed size.
2021-04-28 09:32:49 +02:00
2021-04-29 17:48:15 +02:00
\sa QskSkinnable::strutSizeHint(), QskSkinHintTableEditor::strutSize()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Size
2021-04-29 17:48:15 +02:00
A placeholder for defining a metric.
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Position
2021-04-29 17:48:15 +02:00
A metric that is often used for animating controls ( slide in/out )
or handles.
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Margin
2021-04-29 17:48:15 +02:00
Margins like being described in the CSS Box Model.
\sa QskSkinnable::marginHint(), QskSkinHintTableEditor::margin()
2021-01-25 11:06:01 +01:00
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Padding
2021-04-23 15:15:18 +02:00
2021-04-29 17:48:15 +02:00
Margins like being described in the CSS Box Model.
\sa QskSkinnable::paddingHint(), QskSkinHintTableEditor::padding()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Spacing
2021-04-29 17:48:15 +02:00
A metric, that is used by layout code for the distance between
elements.
\sa QskSkinnable::spacingHint(), QskSkinHintTableEditor::spacing()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Shadow
2021-04-29 17:48:15 +02:00
A primitive to define colors and metrics for shadows.
\sa QskShadowMetrics()
A primitive to define the shape of an element.
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Shape
2021-04-29 17:48:15 +02:00
\sa QskBoxShapeMetrics, QskSkinnable::boxShapeHint(), QskSkinHintTableEditor::boxShape()
2021-04-28 09:32:49 +02:00
\var QskAspect::Primitive QskAspect::Border
2021-04-29 17:48:15 +02:00
A primitive to define colors and metrics for borders.
\sa QskSkinnable::boxBorderMetricsHint(), QskSkinnable::boxBorderColorsHint()
QskSkinHintTableEditor::boxBorderMetrics(), QskSkinHintTableEditor::boxBorderColors()
2021-04-23 15:15:18 +02:00
*/
2021-04-28 09:32:49 +02:00
2021-04-23 15:15:18 +02:00
/*!
\enum QskAspect::Variation
2021-04-23 15:15:18 +02:00
\brief Some sort of variation
2021-04-29 17:48:15 +02:00
The variation bits can be used to have different definitions for
a skinnable depending on its position, orientation or emphasis. F.e a tab bar
2021-04-23 15:15:18 +02:00
looks slightly different depending on its position.
\note flags indicating an orientation can't be used together
with the flags for the position
\sa QskSkinnable::effectiveVariation()
2021-04-23 15:15:18 +02:00
\var QskAspect::Variation QskAspect::NoVariation
No specific variation bits
2021-04-23 15:15:18 +02:00
\var QskAspect::Variation QskAspect::Vertical
2021-04-23 15:15:18 +02:00
Indicates a vertical orientation
\var QskAspect::Variation QskAspect::Horizontal
2021-04-23 15:15:18 +02:00
Indicates a horizontal orientation
\var QskAspect::Variation QskAspect::Top
2021-04-23 15:15:18 +02:00
Indicates a top position
\var QskAspect::Variation QskAspect::Left
2021-04-23 15:15:18 +02:00
Indicates a left position
\var QskAspect::Variation QskAspect::Right
2021-04-23 15:15:18 +02:00
Indicates a right position
\var QskAspect::Variation QskAspect::Bottom
2021-04-23 15:15:18 +02:00
Indicates a bottom position
*/
/*!
\enum QskAspect::Subcontrol
2021-04-29 17:48:15 +02:00
\brief For use within the rendering or lay-outing of a specific QskSkinnable.
2021-04-23 15:15:18 +02:00
While the Default value applies to any control (and can be used as a fallback),
specifying a Subcontrol limits the aspect's scope to that sub-component
(or \em subcontrol) of the control. For example, the Subcontrol type
QskPushButton::Panel refers to the background panel of a push button.
Beside the default values below subcontrols are defined and registered
using the QSK_SUBCONTROL and QSK_SUBCONTROLS macros.
\var QskAspect::Subcontrol QskAspect::Control
No specific subcontrol - used as fallback when resolving skin hints
\var QskAspect::Subcontrol QskAspect::LastSubcontrol
Highest number that fits into the reserved bits for the subcontrol
*/
/*!
\enum QskAspect::State
Applies to a given aspect when the control is in a given state.
2017-07-21 18:21:34 +02:00
QskSkinnable subclasses (typically QskControl subclasses) can define UI
states, as denoted by any OR combination of State flags. For example, a
checked QskPushButton has the QskPushButton::Checked state flag set when
2021-04-23 15:15:18 +02:00
it is checked.
The skin hint resolving algorithms is removing the state bits one by one
until it finds a match, what gives lower bits a higher priority. This
is a rather obscure and error prone approach and needs to be replaced
by something more user friendly. But until this has been done the state
2021-04-29 17:48:15 +02:00
bits are divided into 3 sections:
2021-04-23 15:15:18 +02:00
- [ QskAspect::FirstSystemState, QskAspect::FirstUserState [
High priority state bits
- [ QskAspect::FirstUserState, QskAspect::LastUserState ]
State bits reserved for application code
- ] QskAspect::LastUserState, QskAspect::LastSystemState ]
Low priority state bits
\var QskAspect::State QskAspect::NoState
No specific state
\var QskAspect::FirstSystemState QskAspect::FirstSystemState
First bit of the high priority bits section
\var QskAspect::FirstUserState QskAspect::FirstUserState
First bit of the bits being reserved for application code
\var QskAspect::LastUserState QskAspect::LastUserState
Last bit of the bits being reserved for application code
\var QskAspect::LastSystemState QskAspect::LastSystemState
Highest state bit
\var QskAspect::AllStates
A bit mask for setting all state bits
*/
/*!
\def QSK_SUBCONTROL
*/
/*!
\def QSK_SUBCONTROLS
*/
/*!
\fn QskAspect::QskAspect()
Constructs an aspect with no bits being set.
*/
/*!
\fn QskAspect::QskAspect( Subcontrol )
Constructs an aspect with the subcontrol bits being initialized
\param subControl Initial subcontrol
*/
/*!
\fn QskAspect::QskAspect( Type )
Constructs an aspect with the type bits being initialized
\param type Initial type
*/
/*!
\fn QskAspect::QskAspect( Variation )
2021-04-23 15:15:18 +02:00
Constructs an aspect with the variation bits being initialized
\param variation Initial variation
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::QskAspect( const QskAspect& )
Copy constructor
*/
/*!
\fn QskAspect::QskAspect( QskAspect&& )
Move constructor
*/
/*!
\fn QskAspect::operator=( const QskAspect& )
Assignment operator
*/
/*!
\fn QskAspect::operator==( const QskAspect& )
"Equal to" operator
\sa operator!=(), operator<()
*/
/*!
\fn QskAspect::operator!=( const QskAspect& )
"Not equal to" operator
\sa operator==(), operator<()
*/
/*!
\fn QskAspect::operator<( const QskAspect& )
"Less than" operator
*/
/*!
\fn QskAspect::operator|( Subcontrol ) const
Sets the subcontrol bits
*/
/*!
\fn QskAspect::operator|( Type ) const
Sets the type bits
*/
/*!
2021-04-28 09:32:49 +02:00
\fn QskAspect::operator|( Primitive ) const
2021-04-23 15:15:18 +02:00
Sets the primitive bits
*/
/*!
\fn QskAspect::operator|( Variation ) const
2021-04-23 15:15:18 +02:00
Sets the variation bits
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::operator|( State ) const
ORs state to the state bits
2021-12-02 16:58:44 +01:00
\param state Additional state bit
2021-04-23 15:15:18 +02:00
*/
2021-12-02 16:58:44 +01:00
/*!
\fn QskAspect::operator|( States ) const
ORs states to the state bits
\param states Additional state bits
*/
2021-04-23 15:15:18 +02:00
/*!
\fn QskAspect::stateless
\return A copy of the aspect without the state bits
*/
/*!
\fn QskAspect::trunk
\return A copy of the aspect without the runtime bits ( state, variation ) bits
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::value
\returns All bits interpreted as quint64
*/
/*!
\fn QskAspect::isAnimator
\return true, when the animator bit is set
*/
/*!
\fn QskAspect::setAnimator
Set/Clear the animator bit depending on on
*/
/*!
\fn QskAspect::subControl
\return Subcontrol bits
\sa setSubControl()
*/
/*!
\fn QskAspect::setSubControl
Sets the subcontrol bits
\sa subControl()
*/
/*!
\fn QskAspect::type
\return Type bits
\sa setType()
*/
/*!
\fn QskAspect::setType
Sets the type bits
\sa type()
*/
/*!
\fn QskAspect::isMetric
\return true, if type() equals to QskAspect::Metric
*/
/*!
\fn QskAspect::isColor
\return true, if type() equals to QskAspect::Color
*/
/*!
\fn QskAspect::isFlag
\return true, if type() equals to QskAspect::Flag
*/
/*!
\fn QskAspect::variation
2021-04-23 15:15:18 +02:00
\return Variation bits
\sa setVariation()
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::setVariation
2021-04-23 15:15:18 +02:00
Sets the variation bits
\sa variation()
2021-04-23 15:15:18 +02:00
*/
/*!
2021-12-02 16:58:44 +01:00
\fn QskAspect::states
2021-04-23 15:15:18 +02:00
\return State bits
\sa setState()
*/
/*!
\fn QskAspect::topState
\return Topmost state bit
\sa state()
*/
/*!
2021-12-02 16:58:44 +01:00
\fn QskAspect::setStates
2021-04-23 15:15:18 +02:00
Sets the state bits
\sa addState(), clearState(), hasState(), state()
*/
/*!
2021-12-02 16:58:44 +01:00
\fn QskAspect::addStates
2021-04-23 15:15:18 +02:00
ORs state to the state bits
\sa setState(), clearState(), hasState(), state()
*/
/*!
2021-12-02 16:58:44 +01:00
\fn QskAspect::hasStates
2021-04-23 15:15:18 +02:00
\return true, if any of the state bits is set
*/
/*!
\fn QskAspect::clearState
Clear the state bit for state
\sa setState(), addState(), hasState(), state()
*/
/*!
\fn QskAspect::clearStates
Clears all state bits
\sa clearState() setState(), addState(), hasState(), state()
*/
/*!
\fn QskAspect::flagPrimitive
2021-12-02 16:58:44 +01:00
\return primitive bits, when the aspect is a QskAspect::Flag
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::colorPrimitive
2021-12-02 16:58:44 +01:00
\return primitive bits, when the aspect is a QskAspect::Color
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::metricPrimitive
2021-12-02 16:58:44 +01:00
\return metric bits, when the aspect is a QskAspect::Metric
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::setPrimitive
Sets the primitive bits
2021-04-23 17:31:28 +02:00
\sa primitive(), clearPrimitive()
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::primitive
2021-04-29 17:48:15 +02:00
\return Primitive bits
2021-04-23 15:15:18 +02:00
\sa setPrimitive(), clearPrimitive()
*/
/*!
\fn QskAspect::clearPrimitive()
2021-04-23 17:31:28 +02:00
Clears all primitive bits
\sa setPrimitive(), primitive()
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::toPrintable
\return A printable string for debug purposes
\note The string is internally stored in a buffer that gets reused
every 10 calls. If the string is not only for an immediate
debug statement it needs to be copied out.
*/
/*!
\fn QskAspect::registerState
Registers a printable string for a state.
This method is called from the QSK_STATE and QSK_SYSTEM_STATE
macros and is usually never called manually in application code
*/
/*!
\fn QskAspect::nextSubcontrol
2021-04-29 17:48:15 +02:00
\return Unique ( application wide ) identifier
2021-04-23 15:15:18 +02:00
This method is called from the QSK_SUBCONTROL macro and is usually
never called manually in application code
*/
/*!
\fn QskAspect::subControlName
2021-04-29 17:48:15 +02:00
\return Printable string for a specific subControl
2021-04-23 15:15:18 +02:00
*/
/*!
\fn QskAspect::subControlNames
\return Printable strings of all subControls for a class represented by metaObject
*/
/*!
\fn QskAspect::subControls
\return All subControls for a class represented by metaObject
*/
/*!
\fn QskAspect::primitiveCount
*/
/*!
\fn QskAspect::reservePrimitives
*/