6#include "QskSkinHintTableEditor.h"
7#include "QskSkinHintTable.h"
9#include "QskArcMetrics.h"
10#include "QskMargins.h"
11#include "QskBoxShapeMetrics.h"
12#include "QskBoxBorderMetrics.h"
13#include "QskBoxBorderColors.h"
14#include "QskGraduationMetrics.h"
15#include "QskShadowMetrics.h"
16#include "QskStippleMetrics.h"
17#include "QskGraphic.h"
18#include "QskFontRole.h"
24 using StateInt =
typename std::underlying_type< QskAspect::State >::type;
26 const auto count = qCountTrailingZeroBits(
static_cast< StateInt
>( mask ) );
30 inline void setHintStateMask(
32 bool noState, QskAspect::States states, QskAspect::States mask )
36 if ( noState || states != 0 )
37 table->setHint( aspect | states, hint );
42 const auto stateLow = lowestState( mask );
46 setHintStateMask( table, aspect, hint, noState, states, mask );
47 setHintStateMask( table, aspect, hint, noState, states | stateLow, mask );
50 inline bool removeHintStateMask(
52 bool noState, QskAspect::States states, QskAspect::States mask )
56 if ( noState || states != 0 )
57 return table->removeHint( aspect | states );
62 const auto stateLow = lowestState( mask );
66 bool ret = removeHintStateMask( table, aspect, noState, states, mask );
67 ret |= removeHintStateMask( table, aspect, noState, states | stateLow, mask );
129 return aspect | QskAspect::Option;
134 return aspect | QskAspect::Symbol;
144 return aspect | QskAspect::Graduation;
163void QskSkinHintTableEditor::setHint(
QskAspect aspect,
166 if ( combination.isNull() )
168 m_table->setHint( aspect, hint );
173 ( combination.type() == QskStateCombination::CombinationNoState );
175 setHintStateMask( m_table, aspect, hint,
176 noState, QskAspect::States(), combination.states() );
180bool QskSkinHintTableEditor::removeHint(
183 if ( combination.isNull() )
185 return m_table->removeHint( aspect );
190 ( combination.type() == QskStateCombination::CombinationNoState );
192 return removeHintStateMask( m_table, aspect,
193 noState, QskAspect::States(), combination.states() );
197void QskSkinHintTableEditor::setFlag(
200 setHint( aspect, flag, combination );
203int QskSkinHintTableEditor::flag(
QskAspect aspect )
const
205 return hint< int >( aspect );
208void QskSkinHintTableEditor::setMetric(
211 setMetricHint( aspect, metric, combination );
214qreal QskSkinHintTableEditor::metric(
QskAspect aspect )
const
216 return metricHint< qreal >( aspect );
219void QskSkinHintTableEditor::setColor(
222 setColorHint( aspect, QColor( color ), combination );
225void QskSkinHintTableEditor::setColor(
228 setColorHint( aspect, QColor::fromRgba( rgb ), combination );
231void QskSkinHintTableEditor::setColor(
234 setColorHint( aspect, color, combination );
237QColor QskSkinHintTableEditor::color(
QskAspect aspect )
const
239 return colorHint< QColor >( aspect );
242void QskSkinHintTableEditor::setHGradient(
243 QskAspect aspect,
const QColor& color1,
const QColor& color2,
247 gradient.setLinearDirection( Qt::Horizontal );
249 setGradient( aspect, gradient, combination );
252void QskSkinHintTableEditor::setVGradient(
253 QskAspect aspect,
const QColor& color1,
const QColor& color2,
257 gradient.setLinearDirection( Qt::Vertical );
259 setGradient( aspect, gradient, combination );
262void QskSkinHintTableEditor::setGradient(
263 QskAspect aspect,
const QColor& color1,
const QColor& color2,
267 setColorHint( aspect, gradient, combination );
270void QskSkinHintTableEditor::setGradient(
274 setColorHint( aspect, gradient, combination );
279 return colorHint< QskGradient >( aspect );
282void QskSkinHintTableEditor::setPosition(
285 setMetricHint( aspectPosition( aspect ), position, combination );
288bool QskSkinHintTableEditor::removePosition(
291 return removeMetricHint( aspectPosition( aspect ), combination );
294qreal QskSkinHintTableEditor::position(
QskAspect aspect )
const
296 return metricHint< qreal >( aspectPosition( aspect ) );
299void QskSkinHintTableEditor::setStrutSize(
302 setMetricHint( aspectStrutSize( aspect ), size, combination );
305void QskSkinHintTableEditor::setStrutSize(
308 setMetricHint( aspectStrutSize( aspect ),
309 QSizeF( width, height ), combination );
312bool QskSkinHintTableEditor::removeStrutSize(
315 return removeMetricHint( aspectStrutSize( aspect ), combination );
318QSizeF QskSkinHintTableEditor::strutSize(
QskAspect aspect )
const
320 return metricHint< QSizeF >( aspectStrutSize( aspect ) );
323void QskSkinHintTableEditor::setMargin(
326 setMetricHint( aspectMargin( aspect ), margins, combination );
329void QskSkinHintTableEditor::setMargin(
QskAspect aspect,
330 qreal left, qreal top, qreal right, qreal bottom,
333 const QskMargins margins( left, top, right, bottom );
334 setMetricHint( aspectMargin( aspect ), margins, combination );
337bool QskSkinHintTableEditor::removeMargin(
340 return removeMetricHint( aspectMargin( aspect ), combination );
345 return metricHint< QskMargins >( aspectMargin( aspect ) );
348void QskSkinHintTableEditor::setPadding(
352 setMetricHint( aspectPadding( aspect ), padding, combination );
355void QskSkinHintTableEditor::setPadding(
QskAspect aspect,
356 qreal left, qreal top, qreal right, qreal bottom,
359 QskMargins padding( left, top, right, bottom );
360 setMetricHint( aspectPadding( aspect ), padding, combination );
363bool QskSkinHintTableEditor::removePadding(
366 return removeMetricHint( aspectPadding( aspect ), combination );
371 return metricHint< QskMargins >( aspectPadding( aspect ) );
374void QskSkinHintTableEditor::setSpacing(
377 setMetricHint( aspectSpacing( aspect ), spacing, combination );
380bool QskSkinHintTableEditor::removeSpacing(
383 return removeMetricHint( aspectSpacing( aspect ), combination );
386qreal QskSkinHintTableEditor::spacing(
QskAspect aspect )
const
388 return metricHint< qreal >( aspectSpacing( aspect ) );
391void QskSkinHintTableEditor::setAlignment(
394 setFlag( aspectAlignment( aspect ), alignment, combination );
397bool QskSkinHintTableEditor::removeAlignment(
400 return removeHint( aspectAlignment( aspect ), combination );
403Qt::Alignment QskSkinHintTableEditor::alignment(
QskAspect aspect )
const
405 return hint< Qt::Alignment >( aspectAlignment( aspect ) );
408void QskSkinHintTableEditor::setFontRole(
411 setHint( aspectFontRole( aspect ), fontRole, combination );
414bool QskSkinHintTableEditor::removeFontRole(
417 return removeHint( aspectFontRole( aspect ), combination );
422 return hint< QskFontRole >( aspectFontRole( aspect ) );
425void QskSkinHintTableEditor::setGraphicRole(
428 setHint( aspectGraphicRole( aspect ), graphicRole, combination );
431bool QskSkinHintTableEditor::removeGraphicRole(
434 return removeHint( aspectGraphicRole( aspect ), combination );
437int QskSkinHintTableEditor::graphicRole(
QskAspect aspect )
const
439 return hint< int >( aspectGraphicRole( aspect ) );
442void QskSkinHintTableEditor::setBoxShape(
443 QskAspect aspect, qreal radius, Qt::SizeMode sizeMode )
445 setMetricHint( aspectShape( aspect ),
449void QskSkinHintTableEditor::setBoxShape(
QskAspect aspect,
450 qreal topLeft, qreal topRight, qreal bottomLeft, qreal bottomRight,
451 Qt::SizeMode sizeMode )
453 setMetricHint( aspectShape( aspect ),
457void QskSkinHintTableEditor::setBoxShape(
461 setMetricHint( aspectShape( aspect ), shape, combination );
464bool QskSkinHintTableEditor::removeBoxShape(
467 return removeMetricHint( aspectShape( aspect ), combination );
472 return metricHint< QskBoxShapeMetrics >( aspectShape( aspect ) );
475void QskSkinHintTableEditor::setBoxBorderMetrics(
QskAspect aspect,
476 qreal borderWidth, Qt::SizeMode sizeMode )
478 setMetricHint( aspectBorder( aspect ),
482void QskSkinHintTableEditor::setBoxBorderMetrics(
QskAspect aspect,
483 qreal left, qreal top, qreal right, qreal bottom, Qt::SizeMode sizeMode )
485 setMetricHint( aspectBorder( aspect ),
489void QskSkinHintTableEditor::setBoxBorderMetrics(
493 setMetricHint( aspectBorder( aspect ), borderMetrics, combination );
496bool QskSkinHintTableEditor::removeBoxBorderMetric(
499 return removeMetricHint( aspectBorder( aspect ), combination );
504 return metricHint< QskBoxBorderMetrics >( aspectBorder( aspect ) );
507void QskSkinHintTableEditor::setBoxBorderColors(
511 setColorHint( aspectBorder( aspect ), borderColors, combination );
514void QskSkinHintTableEditor::setBoxBorderColors(
QskAspect aspect,
518 setColorHint( aspectBorder( aspect ),
522bool QskSkinHintTableEditor::removeBoxBorderColors(
525 return removeColorHint( aspectBorder( aspect ), combination );
530 return colorHint< QskBoxBorderColors >( aspectBorder( aspect ) );
533void QskSkinHintTableEditor::setShadowMetrics(
QskAspect aspect,
534 qreal spreadRadius, qreal blurRadius,
const QPointF& offset, Qt::SizeMode sizeMode )
536 setMetricHint( aspectShadow( aspect ),
540void QskSkinHintTableEditor::setShadowMetrics(
QskAspect aspect,
543 setMetricHint( aspectShadow( aspect ), metrics, combination );
546bool QskSkinHintTableEditor::removeShadowMetric(
549 return removeMetricHint( aspectShadow( aspect ), combination );
554 return metricHint< QskShadowMetrics >( aspectShadow( aspect ) );
557void QskSkinHintTableEditor::setShadowColor(
QskAspect aspect,
560 setColorHint( aspectShadow( aspect ), color, combination );
563void QskSkinHintTableEditor::setShadowColor(
QskAspect aspect,
566 setColorHint( aspectShadow( aspect ), QColor( color ), combination );
569void QskSkinHintTableEditor::setShadowColor(
QskAspect aspect,
572 setColorHint( aspectShadow( aspect ), QColor::fromRgba( rgb ), combination );
575bool QskSkinHintTableEditor::removeShadowColor(
578 return removeColorHint( aspectShadow( aspect ), combination );
581QColor QskSkinHintTableEditor::shadowColor(
QskAspect aspect )
const
583 return colorHint< QColor >( aspectShadow( aspect ) );
586void QskSkinHintTableEditor::setArcMetrics(
QskAspect aspect,
587 qreal startAngle, qreal spanAngle, qreal thickness, Qt::SizeMode sizeMode )
589 setMetricHint( aspectShape( aspect ),
590 QskArcMetrics( startAngle, spanAngle, thickness, sizeMode ) );
593void QskSkinHintTableEditor::setArcMetrics(
QskAspect aspect,
596 setMetricHint( aspectShape( aspect ), arcMetrics, combination );
599bool QskSkinHintTableEditor::removeArcMetrics(
602 return removeMetricHint( aspectShape( aspect ), combination );
607 return metricHint< QskArcMetrics >( aspectShape( aspect ) );
610void QskSkinHintTableEditor::setStippleMetrics(
QskAspect aspect,
616void QskSkinHintTableEditor::setStippleMetrics(
QskAspect aspect,
622void QskSkinHintTableEditor::setStippleMetrics(
QskAspect aspect,
625 setMetricHint( aspectStipple( aspect ), metrics, combination );
628bool QskSkinHintTableEditor::removeStippleMetrics(
631 return removeMetricHint( aspectStipple( aspect ), combination );
636 return metricHint< QskStippleMetrics >( aspectStipple( aspect ) );
639void QskSkinHintTableEditor::setGraduationMetrics(
QskAspect aspect,
642 setMetricHint( aspectGraduation( aspect ), metrics, combination );
645bool QskSkinHintTableEditor::removeGraduationMetrics(
648 return removeMetricHint( aspectGraduation( aspect ), combination );
653 return metricHint< QskGraduationMetrics >( aspectGraduation( aspect ) );
656void QskSkinHintTableEditor::setTextOptions(
QskAspect aspect,
657 Qt::TextElideMode elideMode, QskTextOptions::WrapMode wrapMode,
661 options.setElideMode( elideMode );
662 options.setWrapMode( wrapMode );
664 setTextOptions( aspect, options, combination );
667void QskSkinHintTableEditor::setTextOptions(
QskAspect aspect,
670 setHint( aspectOption( aspect ), textOptions, combination );
673bool QskSkinHintTableEditor::removeTextOptions(
676 return removeHint( aspectOption( aspect ), combination );
681 return hint< QskTextOptions >( aspectOption( aspect ) );
684void QskSkinHintTableEditor::setSymbol(
QskAspect aspect,
687 setHint( aspectSymbol( aspect ), symbol, combination );
690bool QskSkinHintTableEditor::removeSymbol(
693 return removeHint( aspectSymbol( aspect ), combination );
698 return hint< QskGraphic >( aspectSymbol( aspect ) );
Lookup key for a QskSkinHintTable.
A paint device for scalable graphics.