more complex types of skin hints ( starting with QskMargins, but more to
come )
This commit is contained in:
parent
230bd83f61
commit
6a0c6aa6bd
@ -12,6 +12,7 @@
|
|||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskSeparator.h>
|
#include <QskSeparator.h>
|
||||||
#include <QskColorFilter.h>
|
#include <QskColorFilter.h>
|
||||||
|
#include <QskMargins.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ void DefaultSkin::initHints()
|
|||||||
|
|
||||||
// -- push buttons
|
// -- push buttons
|
||||||
|
|
||||||
setMetric( QskPushButton::Panel | QskAspect::Padding, 10 );
|
setMargins( QskPushButton::Panel | QskAspect::Padding, 10 );
|
||||||
setColor( QskPushButton::Panel, m_palette->color1 );
|
setColor( QskPushButton::Panel, m_palette->color1 );
|
||||||
setColor( QskPushButton::Text, m_palette->color3 );
|
setColor( QskPushButton::Text, m_palette->color3 );
|
||||||
setColor( QskPushButton::Panel | QskPushButton::Pressed, m_palette->color2 );
|
setColor( QskPushButton::Panel | QskPushButton::Pressed, m_palette->color2 );
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskSeparator.h>
|
#include <QskSeparator.h>
|
||||||
#include <QskColorFilter.h>
|
#include <QskColorFilter.h>
|
||||||
|
#include <QskMargins.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ void OtherSkin::initHints()
|
|||||||
// -- push buttons
|
// -- push buttons
|
||||||
|
|
||||||
setMetric( QskPushButton::Panel | QskAspect::Radius, 4 );
|
setMetric( QskPushButton::Panel | QskAspect::Radius, 4 );
|
||||||
setMetric( QskPushButton::Panel | QskAspect::Padding, 8 );
|
setMargins( QskPushButton::Panel | QskAspect::Padding, 8 );
|
||||||
setColor( QskPushButton::Panel, m_palette->color1 );
|
setColor( QskPushButton::Panel, m_palette->color1 );
|
||||||
setColor( QskPushButton::Text, m_palette->color3 );
|
setColor( QskPushButton::Text, m_palette->color3 );
|
||||||
setColor( QskPushButton::Panel | QskPushButton::Pressed, m_palette->color2 );
|
setColor( QskPushButton::Panel | QskPushButton::Pressed, m_palette->color2 );
|
||||||
|
@ -24,8 +24,8 @@ public:
|
|||||||
setMargins( QMarginsF( 15, 10, 10, 10 ) );
|
setMargins( QMarginsF( 15, 10, 10, 10 ) );
|
||||||
setAlternatingRowColors( true );
|
setAlternatingRowColors( true );
|
||||||
|
|
||||||
// increasing the height of each row: usually the job of the skin !
|
// increasing the padding of each row: usually the job of the skin !
|
||||||
setMetric( Cell | Padding | HorizontalEdges, 20 );
|
setMarginsHint( Cell | Padding, QMargins( 10, 20, 10, 20 ) );
|
||||||
|
|
||||||
populate();
|
populate();
|
||||||
|
|
||||||
|
@ -34,11 +34,12 @@ public:
|
|||||||
|
|
||||||
const qreal h = 30;
|
const qreal h = 30;
|
||||||
const qreal w = 2.0 * h;
|
const qreal w = 2.0 * h;
|
||||||
|
const qreal paddingW = 0.5 * w + 1;
|
||||||
|
|
||||||
// Panel
|
// Panel
|
||||||
setMetric( Panel | Size, h );
|
setMetric( Panel | Size, h );
|
||||||
setMetric( Panel | Border, 1 );
|
setMetric( Panel | Border, 1 );
|
||||||
setMetric( Panel | Padding | VerticalEdges, 0.5 * w + 1 );
|
setMarginsHint( Panel | Padding, QMarginsF( paddingW, 0, paddingW, 0 ) );
|
||||||
|
|
||||||
setColor( Panel | Border, QskRgbValue::Grey900 );
|
setColor( Panel | Border, QskRgbValue::Grey900 );
|
||||||
setColor( Panel, QskRgbValue::Grey400 );
|
setColor( Panel, QskRgbValue::Grey400 );
|
||||||
@ -56,7 +57,7 @@ public:
|
|||||||
setMetric( Handle | Border, 1 );
|
setMetric( Handle | Border, 1 );
|
||||||
|
|
||||||
const qreal m = qCeil( 0.5 * ( w - h ) ) + 2;
|
const qreal m = qCeil( 0.5 * ( w - h ) ) + 2;
|
||||||
setMetric( Handle | Margin | VerticalEdges, -m );
|
setMarginsHint( Handle | Margin, QMarginsF( -m, 0, -m, 0 ) );
|
||||||
|
|
||||||
for ( auto state : { NoState, Pressed } )
|
for ( auto state : { NoState, Pressed } )
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ void LineEdit::updateLayout()
|
|||||||
{
|
{
|
||||||
Inherited::updateLayout();
|
Inherited::updateLayout();
|
||||||
|
|
||||||
const auto padding = edgeMetrics( Panel, QskAspect::Padding );
|
const QMarginsF padding = marginsHint( Panel | QskAspect::Padding );
|
||||||
|
|
||||||
Q_P( QQuickTextInput );
|
Q_P( QQuickTextInput );
|
||||||
p->QQuickTextInput::setLeftPadding( padding.left() );
|
p->QQuickTextInput::setLeftPadding( padding.left() );
|
||||||
|
@ -123,13 +123,13 @@ public:
|
|||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
|
|
||||||
QFontMetricsF fm( effectiveFont( Text ) );
|
const QFontMetricsF fm( effectiveFont( Text ) );
|
||||||
|
|
||||||
for ( auto entry : m_values )
|
for ( auto entry : m_values )
|
||||||
m_maxWidth = qMax( m_maxWidth, fm.width( entry.first ) );
|
m_maxWidth = qMax( m_maxWidth, fm.width( entry.first ) );
|
||||||
|
|
||||||
m_maxWidth += metric( Cell | Padding | LeftEdge )
|
const QMarginsF padding = marginsHint( Cell | Padding );
|
||||||
+ metric( Cell | Padding | RightEdge );
|
m_maxWidth += padding.left() + padding.right();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_maxWidth;
|
return m_maxWidth;
|
||||||
@ -139,9 +139,10 @@ public:
|
|||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
|
|
||||||
return QFontMetrics( effectiveFont( Text ) ).height()
|
const QFontMetricsF fm( effectiveFont( Text ) );
|
||||||
+ metric( Cell | Padding | TopEdge )
|
const QMarginsF padding = marginsHint( Cell | Padding );
|
||||||
+ metric( Cell | Padding | BottomEdge );
|
|
||||||
|
return fm.height() + padding.top() + padding.bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QVariant valueAt( int row, int ) const override final
|
virtual QVariant valueAt( int row, int ) const override final
|
||||||
|
@ -322,10 +322,7 @@ void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect::Asp
|
|||||||
|
|
||||||
switch( aspect.boxPrimitive() )
|
switch( aspect.boxPrimitive() )
|
||||||
{
|
{
|
||||||
case Margin:
|
|
||||||
case Padding:
|
|
||||||
case Border:
|
case Border:
|
||||||
case Shadow:
|
|
||||||
{
|
{
|
||||||
if ( aspect.edge() )
|
if ( aspect.edge() )
|
||||||
debug << ", " << qskEnumString( "Edge", aspect.edge() );
|
debug << ", " << qskEnumString( "Edge", aspect.edge() );
|
||||||
|
@ -73,12 +73,9 @@ QSK_NAMESPACE( QskAspect )
|
|||||||
{
|
{
|
||||||
Background = 0,
|
Background = 0,
|
||||||
|
|
||||||
Margin = 1,
|
|
||||||
Padding = 2,
|
|
||||||
RadiusX = 3,
|
RadiusX = 3,
|
||||||
RadiusY = 4,
|
RadiusY = 4,
|
||||||
Border = 5,
|
Border = 5,
|
||||||
Shadow = 6,
|
|
||||||
|
|
||||||
Radius = 7, // RadiusX | RadiusY
|
Radius = 7, // RadiusX | RadiusY
|
||||||
};
|
};
|
||||||
@ -107,6 +104,11 @@ QSK_NAMESPACE( QskAspect )
|
|||||||
MinimumHeight,
|
MinimumHeight,
|
||||||
MaximumWidth,
|
MaximumWidth,
|
||||||
MaximumHeight,
|
MaximumHeight,
|
||||||
|
|
||||||
|
Margin,
|
||||||
|
Padding,
|
||||||
|
Shadow,
|
||||||
|
|
||||||
Spacing
|
Spacing
|
||||||
};
|
};
|
||||||
QSK_ENUM( MetricPrimitive )
|
QSK_ENUM( MetricPrimitive )
|
||||||
|
66
src/common/QskMargins.cpp
Normal file
66
src/common/QskMargins.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "QskMargins.h"
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
static inline qreal qskInterpolated( qreal from, qreal to, qreal ratio )
|
||||||
|
{
|
||||||
|
return from + ( to - from ) * ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline QskMargins qskInterpolateMargins(
|
||||||
|
const QskMargins& m1, const QskMargins& m2, qreal progress )
|
||||||
|
{
|
||||||
|
const qreal left = qskInterpolated( m1.left(), m2.left(), progress );
|
||||||
|
const qreal top = qskInterpolated( m1.top(), m2.top(), progress );
|
||||||
|
const qreal right = qskInterpolated( m1.right(), m2.right(), progress );
|
||||||
|
const qreal bottom = qskInterpolated( m1.bottom(), m2.bottom(), progress );
|
||||||
|
|
||||||
|
return QskMargins( left, top, right, bottom );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskMargins QskMargins::interpolated(
|
||||||
|
const QskMargins& to, qreal progress ) const noexcept
|
||||||
|
{
|
||||||
|
return qskInterpolateMargins( *this, to, progress );
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant QskMargins::interpolate(
|
||||||
|
const QskMargins& m1, const QskMargins& m2, qreal progress ) noexcept
|
||||||
|
{
|
||||||
|
return QVariant::fromValue( qskInterpolateMargins( m1, m2, progress ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskMargins::setMarginsAt( Qt::Edges edges, qreal value ) noexcept
|
||||||
|
{
|
||||||
|
if ( edges & Qt::LeftEdge )
|
||||||
|
setLeft( value );
|
||||||
|
|
||||||
|
if ( edges & Qt::TopEdge )
|
||||||
|
setTop( value );
|
||||||
|
|
||||||
|
if ( edges & Qt::RightEdge )
|
||||||
|
setRight( value );
|
||||||
|
|
||||||
|
if ( edges & Qt::BottomEdge )
|
||||||
|
setBottom( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal QskMargins::marginAt( Qt::Edge edge ) const noexcept
|
||||||
|
{
|
||||||
|
switch( edge )
|
||||||
|
{
|
||||||
|
case Qt::LeftEdge:
|
||||||
|
return left();
|
||||||
|
|
||||||
|
case Qt::TopEdge:
|
||||||
|
return top();
|
||||||
|
|
||||||
|
case Qt::RightEdge:
|
||||||
|
return right();
|
||||||
|
|
||||||
|
case Qt::BottomEdge:
|
||||||
|
return bottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
132
src/common/QskMargins.h
Normal file
132
src/common/QskMargins.h
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||||
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QSK_MARGINS_H
|
||||||
|
#define QSK_MARGINS_H
|
||||||
|
|
||||||
|
#include "QskGlobal.h"
|
||||||
|
|
||||||
|
#include <QMarginsF>
|
||||||
|
#include <Qt>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
|
class QVariant;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Having a wrapper like this feels a bit stupid, but unfortunately QMarginsF
|
||||||
|
is not registered as Qt metatype and doing this in an external library
|
||||||
|
is an obvious source for conflicts with application code.
|
||||||
|
*/
|
||||||
|
class QSK_EXPORT QskMargins : public QMarginsF
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
constexpr QskMargins() noexcept = default;
|
||||||
|
constexpr QskMargins( const QMarginsF& ) noexcept;
|
||||||
|
constexpr QskMargins( const QMargins& ) noexcept;
|
||||||
|
|
||||||
|
constexpr QskMargins( qreal left, qreal top, qreal right, qreal bottom ) noexcept;
|
||||||
|
constexpr QskMargins( qreal margin ) noexcept;
|
||||||
|
constexpr QskMargins( qreal horizontal, qreal vertical ) noexcept;
|
||||||
|
|
||||||
|
QskMargins mirrored( Qt::Orientations ) const noexcept;
|
||||||
|
constexpr QskMargins rotated() const noexcept;
|
||||||
|
|
||||||
|
constexpr QskMargins translated( qreal dx, qreal dy ) const noexcept;
|
||||||
|
constexpr QskMargins expanded( qreal dx, qreal dy ) const noexcept;
|
||||||
|
|
||||||
|
void setMargins( qreal margin ) noexcept;
|
||||||
|
void setMargins( qreal horizontal, qreal vertical ) noexcept;
|
||||||
|
|
||||||
|
void setMarginsAt( Qt::Edges, qreal ) noexcept;
|
||||||
|
qreal marginAt( Qt::Edge ) const noexcept;
|
||||||
|
|
||||||
|
constexpr qreal length( Qt::Orientation ) const noexcept;
|
||||||
|
|
||||||
|
QskMargins interpolated( const QskMargins&, qreal progress ) const noexcept;
|
||||||
|
|
||||||
|
static QVariant interpolate( const QskMargins&,
|
||||||
|
const QskMargins&, qreal progress ) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr inline QskMargins::QskMargins( qreal margin ) noexcept:
|
||||||
|
QskMargins( margin, margin, margin, margin )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr inline QskMargins::QskMargins( qreal horizontal, qreal vertical ) noexcept:
|
||||||
|
QskMargins( horizontal, vertical, horizontal, vertical )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr QskMargins::QskMargins(
|
||||||
|
qreal left, qreal top, qreal right, qreal bottom ) noexcept:
|
||||||
|
QMarginsF( left, top, right, bottom )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr inline QskMargins::QskMargins( const QMarginsF& margins ) noexcept:
|
||||||
|
QMarginsF( margins )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr inline QskMargins::QskMargins( const QMargins& margins ) noexcept:
|
||||||
|
QMarginsF( margins )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskMargins::setMargins( qreal margin ) noexcept
|
||||||
|
{
|
||||||
|
*this = QskMargins( margin );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskMargins::setMargins( qreal horizontal, qreal vertical ) noexcept
|
||||||
|
{
|
||||||
|
*this = QskMargins( horizontal, vertical );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QskMargins QskMargins::mirrored(
|
||||||
|
Qt::Orientations orientations ) const noexcept
|
||||||
|
{
|
||||||
|
switch( int( orientations ) )
|
||||||
|
{
|
||||||
|
case Qt::Vertical:
|
||||||
|
return QskMargins( left(), bottom(), right(), top() );
|
||||||
|
|
||||||
|
case Qt::Horizontal:
|
||||||
|
return QskMargins( right(), top(), left(), bottom() );
|
||||||
|
|
||||||
|
case Qt::Vertical | Qt::Horizontal:
|
||||||
|
return QskMargins( right(), bottom(), left(), top() );
|
||||||
|
|
||||||
|
default:
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr inline QskMargins QskMargins::rotated() const noexcept
|
||||||
|
{
|
||||||
|
return QskMargins( top(), left(), bottom(), right() );
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr inline QskMargins QskMargins::translated( qreal dx, qreal dy ) const noexcept
|
||||||
|
{
|
||||||
|
return QskMargins( left() + dx, top() + dy, right() - dx, bottom() - dy );
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr QskMargins QskMargins::expanded( qreal dx, qreal dy ) const noexcept
|
||||||
|
{
|
||||||
|
return QskMargins( left() + dx, top() + dy, right() + dx, bottom() + dy );
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr qreal QskMargins::length( Qt::Orientation orientation ) const noexcept
|
||||||
|
{
|
||||||
|
return ( orientation == Qt::Horizontal )
|
||||||
|
? ( left() + right() ) : ( top() + bottom() );
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_DECLARE_TYPEINFO( QskMargins, Q_MOVABLE_TYPE );
|
||||||
|
Q_DECLARE_METATYPE( QskMargins )
|
||||||
|
|
||||||
|
#endif
|
@ -570,13 +570,7 @@ void QskControl::setMargins( const QMarginsF& margins )
|
|||||||
|
|
||||||
if ( m != this->margins() )
|
if ( m != this->margins() )
|
||||||
{
|
{
|
||||||
Aspect aspect = subControl | Margin;
|
setMarginsHint( subControl | Margin, m );
|
||||||
|
|
||||||
setMetric( aspect | LeftEdge, m.left() );
|
|
||||||
setMetric( aspect | TopEdge, m.top() );
|
|
||||||
setMetric( aspect | RightEdge, m.right() );
|
|
||||||
setMetric( aspect | BottomEdge, m.bottom() );
|
|
||||||
|
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
|
|
||||||
if ( m_polishOnResize || m_autoLayoutChildren )
|
if ( m_polishOnResize || m_autoLayoutChildren )
|
||||||
@ -593,7 +587,7 @@ void QskControl::resetMargins()
|
|||||||
|
|
||||||
QMarginsF QskControl::margins() const
|
QMarginsF QskControl::margins() const
|
||||||
{
|
{
|
||||||
return edgeMetrics( QskAspect::Control, QskAspect::Margin );
|
return marginsHint( QskAspect::Control | QskAspect::Margin );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskControl::contentsRect() const
|
QRectF QskControl::contentsRect() const
|
||||||
|
@ -79,7 +79,7 @@ void QskFocusIndicator::updateFocusFrame()
|
|||||||
|
|
||||||
if ( !r.isEmpty() )
|
if ( !r.isEmpty() )
|
||||||
{
|
{
|
||||||
r = r.marginsAdded( edgeMetrics( Panel, QskAspect::Padding ) );
|
r = r.marginsAdded( marginsHint( Panel | QskAspect::Padding ) );
|
||||||
setGeometry( r );
|
setGeometry( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "QskAnimationHint.h"
|
#include "QskAnimationHint.h"
|
||||||
#include "QskControl.h"
|
#include "QskControl.h"
|
||||||
#include "QskEvent.h"
|
#include "QskEvent.h"
|
||||||
|
#include "QskMargins.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
@ -15,6 +16,12 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
static inline qreal qskAligned05( qreal value )
|
||||||
|
{
|
||||||
|
// aligned to 0.5
|
||||||
|
return qRound( 2.0 * value ) / 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool qskCheckReceiverThread( const QObject *receiver )
|
static inline bool qskCheckReceiverThread( const QObject *receiver )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -34,7 +41,6 @@ static inline bool qskCheckReceiverThread( const QObject *receiver )
|
|||||||
static inline QVariant qskAdjustedValue(
|
static inline QVariant qskAdjustedValue(
|
||||||
QskAspect::Aspect aspect, const QVariant& value )
|
QskAspect::Aspect aspect, const QVariant& value )
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
if( value.type() == QVariant::Double )
|
if( value.type() == QVariant::Double )
|
||||||
{
|
{
|
||||||
if ( aspect.metricPrimitive() != QskAspect::Position )
|
if ( aspect.metricPrimitive() != QskAspect::Position )
|
||||||
@ -42,10 +48,17 @@ static inline QVariant qskAdjustedValue(
|
|||||||
// all beside QskAspect::Position are real metrics,
|
// all beside QskAspect::Position are real metrics,
|
||||||
// that will be aligned to the resolution of the paint device
|
// that will be aligned to the resolution of the paint device
|
||||||
// so we can avoid pointless operations by rounding
|
// so we can avoid pointless operations by rounding
|
||||||
return qRound( 2.0 * value.toReal() ) / 2.0;
|
return qskAligned05( value.toReal() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
else if ( value.canConvert< QskMargins >() )
|
||||||
|
{
|
||||||
|
const QskMargins m = value.value< QskMargins >();
|
||||||
|
|
||||||
|
return QVariant::fromValue(
|
||||||
|
QskMargins( qskAligned05( m.left() ), qskAligned05( m.top() ),
|
||||||
|
qskAligned05( m.right() ), qskAligned05( m.bottom() ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void QskListViewSkinlet::updateForegroundNodes(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMarginsF margins = listView->edgeMetrics( QskListView::Cell, QskAspect::Padding );
|
const QMarginsF margins = listView->marginsHint( QskListView::Cell | QskAspect::Padding );
|
||||||
|
|
||||||
const QRectF cr = listView->viewContentsRect();
|
const QRectF cr = listView->viewContentsRect();
|
||||||
const QPointF scrolledPos = listView->scrollPos();
|
const QPointF scrolledPos = listView->scrollPos();
|
||||||
|
@ -236,7 +236,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect(
|
|||||||
const auto subControlBar = QskScrollView::VerticalScrollBar;
|
const auto subControlBar = QskScrollView::VerticalScrollBar;
|
||||||
|
|
||||||
const QRectF sbRect = subControlRect( scrollView, subControlBar );
|
const QRectF sbRect = subControlRect( scrollView, subControlBar );
|
||||||
const auto padding = scrollView->edgeMetrics( subControlBar, QskAspect::Padding );
|
const QMarginsF padding = scrollView->marginsHint( subControlBar | QskAspect::Padding );
|
||||||
|
|
||||||
const qreal h = scrollView->scrollableSize().height();
|
const qreal h = scrollView->scrollableSize().height();
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect(
|
|||||||
const auto subControlBar = QskScrollView::HorizontalScrollBar;
|
const auto subControlBar = QskScrollView::HorizontalScrollBar;
|
||||||
|
|
||||||
const QRectF sbRect = subControlRect( scrollView, subControlBar );
|
const QRectF sbRect = subControlRect( scrollView, subControlBar );
|
||||||
const auto padding = scrollView->edgeMetrics( subControlBar, QskAspect::Padding );
|
const auto padding = scrollView->marginsHint( subControlBar | QskAspect::Padding );
|
||||||
|
|
||||||
const qreal w = scrollView->scrollableSize().width();
|
const qreal w = scrollView->scrollableSize().width();
|
||||||
|
|
||||||
|
@ -279,23 +279,19 @@ int QskSimpleListBox::columnCount() const
|
|||||||
|
|
||||||
qreal QskSimpleListBox::columnWidth( int col ) const
|
qreal QskSimpleListBox::columnWidth( int col ) const
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
|
||||||
|
|
||||||
if ( col >= columnCount() )
|
if ( col >= columnCount() )
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
return m_data->maxTextWidth
|
const QMarginsF padding = marginsHint( Cell | QskAspect::Padding );
|
||||||
+ metric( Cell | Padding | LeftEdge )
|
return m_data->maxTextWidth + padding.left() + padding.right();
|
||||||
+ metric( Cell | Padding | RightEdge );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskSimpleListBox::rowHeight() const
|
qreal QskSimpleListBox::rowHeight() const
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
const QMarginsF padding = marginsHint( Cell | QskAspect::Padding );
|
||||||
|
const QFontMetricsF fm( effectiveFont( Text ) );
|
||||||
|
|
||||||
return QFontMetrics( effectiveFont( Text ) ).height()
|
return fm.height() + padding.top() + padding.bottom();
|
||||||
+ metric( Cell | Padding | TopEdge )
|
|
||||||
+ metric( Cell | Padding | BottomEdge );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_QskSimpleListBox.cpp"
|
#include "moc_QskSimpleListBox.cpp"
|
||||||
|
@ -184,6 +184,16 @@ qreal QskSkin::metric( QskAspect::Aspect aspect ) const
|
|||||||
return m_data->hintTable.metric( aspect );
|
return m_data->hintTable.metric( aspect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskSkin::setMargins( QskAspect::Aspect aspect, const QskMargins& margins )
|
||||||
|
{
|
||||||
|
m_data->hintTable.setMargins( aspect, margins );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskMargins QskSkin::margins( QskAspect::Aspect aspect ) const
|
||||||
|
{
|
||||||
|
return m_data->hintTable.margins( aspect );
|
||||||
|
}
|
||||||
|
|
||||||
void QskSkin::setAnimation(
|
void QskSkin::setAnimation(
|
||||||
QskAspect::Aspect aspect, QskAnimationHint animation )
|
QskAspect::Aspect aspect, QskAnimationHint animation )
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ class QskAnimationHint;
|
|||||||
class QskSkinHintTable;
|
class QskSkinHintTable;
|
||||||
|
|
||||||
class QVariant;
|
class QVariant;
|
||||||
|
class QskMargins;
|
||||||
|
|
||||||
class QSK_EXPORT QskSkin : public QObject
|
class QSK_EXPORT QskSkin : public QObject
|
||||||
{
|
{
|
||||||
@ -65,6 +66,9 @@ public:
|
|||||||
void setMetric( QskAspect::Aspect, qreal metric );
|
void setMetric( QskAspect::Aspect, qreal metric );
|
||||||
qreal metric( QskAspect::Aspect ) const;
|
qreal metric( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
|
void setMargins( QskAspect::Aspect, const QskMargins& );
|
||||||
|
QskMargins margins( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
void setAnimation( QskAspect::Aspect, QskAnimationHint );
|
void setAnimation( QskAspect::Aspect, QskAnimationHint );
|
||||||
QskAnimationHint animation( QskAspect::Aspect ) const;
|
QskAnimationHint animation( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "QskGlobal.h"
|
#include "QskGlobal.h"
|
||||||
#include "QskAspect.h"
|
#include "QskAspect.h"
|
||||||
|
#include "QskMargins.h"
|
||||||
#include "QskAnimationHint.h"
|
#include "QskAnimationHint.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -31,6 +32,9 @@ public:
|
|||||||
void setMetric( QskAspect::Aspect, qreal metric );
|
void setMetric( QskAspect::Aspect, qreal metric );
|
||||||
qreal metric( QskAspect::Aspect ) const;
|
qreal metric( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
|
void setMargins( QskAspect::Aspect, const QskMargins& );
|
||||||
|
QskMargins margins( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
void setAnimation( QskAspect::Aspect, QskAnimationHint animation );
|
void setAnimation( QskAspect::Aspect, QskAnimationHint animation );
|
||||||
QskAnimationHint animation( QskAspect::Aspect ) const;
|
QskAnimationHint animation( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
@ -100,6 +104,16 @@ inline qreal QskSkinHintTable::metric( QskAspect::Aspect aspect ) const
|
|||||||
return skinHint( aspect | QskAspect::Metric ).toReal();
|
return skinHint( aspect | QskAspect::Metric ).toReal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void QskSkinHintTable::setMargins( QskAspect::Aspect aspect, const QskMargins& margins )
|
||||||
|
{
|
||||||
|
setSkinHint( aspect | QskAspect::Metric, QVariant::fromValue( margins ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QskMargins QskSkinHintTable::margins( QskAspect::Aspect aspect ) const
|
||||||
|
{
|
||||||
|
return skinHint( aspect | QskAspect::Metric ).value< QskMargins >();
|
||||||
|
}
|
||||||
|
|
||||||
inline void QskSkinHintTable::setAnimation(
|
inline void QskSkinHintTable::setAnimation(
|
||||||
QskAspect::Aspect aspect, QskAnimationHint animation )
|
QskAspect::Aspect aspect, QskAnimationHint animation )
|
||||||
{
|
{
|
||||||
|
@ -208,7 +208,7 @@ static inline QskAspect::Edge qskRotateEdge( QskAspect::Edge edge, int count )
|
|||||||
QMarginsF QskSkinRenderer::margins( const QskSkinnable* skinnable,
|
QMarginsF QskSkinRenderer::margins( const QskSkinnable* skinnable,
|
||||||
QskAspect::Subcontrol subControl, int rotation )
|
QskAspect::Subcontrol subControl, int rotation )
|
||||||
{
|
{
|
||||||
const QMarginsF m = skinnable->edgeMetrics( subControl, QskAspect::Margin );
|
const QMarginsF m = skinnable->marginsHint( subControl | QskAspect::Margin );
|
||||||
return qskRotatedMargins( m, rotation );
|
return qskRotatedMargins( m, rotation );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,10 +250,10 @@ QskBoxOptions QskSkinRenderer::boxOptions( const QskSkinnable* skinnable,
|
|||||||
QskBoxOptions options;
|
QskBoxOptions options;
|
||||||
|
|
||||||
options.borders = qskRotatedMargins(
|
options.borders = qskRotatedMargins(
|
||||||
skinnable->edgeMetrics( subControl, Border ), rotation );
|
skinnable->borderMetrics( subControl ), rotation );
|
||||||
|
|
||||||
options.shadows = qskRotatedMargins(
|
options.shadows = qskRotatedMargins(
|
||||||
skinnable->edgeMetrics( subControl, Shadow ), rotation );
|
skinnable->marginsHint( subControl | Shadow ), rotation );
|
||||||
|
|
||||||
const auto leftEdge = qskRotateEdge( LeftEdge, rotation );
|
const auto leftEdge = qskRotateEdge( LeftEdge, rotation );
|
||||||
const auto topEdge = qskRotateEdge( TopEdge, rotation );
|
const auto topEdge = qskRotateEdge( TopEdge, rotation );
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "QskSkinHintTable.h"
|
#include "QskSkinHintTable.h"
|
||||||
#include "QskSkinlet.h"
|
#include "QskSkinlet.h"
|
||||||
#include "QskAnimationHint.h"
|
#include "QskAnimationHint.h"
|
||||||
|
#include "QskMargins.h"
|
||||||
#include "QskHintAnimator.h"
|
#include "QskHintAnimator.h"
|
||||||
#include "QskControl.h"
|
#include "QskControl.h"
|
||||||
#include "QskColorFilter.h"
|
#include "QskColorFilter.h"
|
||||||
@ -256,12 +257,22 @@ qreal QskSkinnable::metric( QskAspect::Aspect aspect, QskSkinHintStatus* status
|
|||||||
return effectiveHint( aspect | QskAspect::Metric, status ).toReal();
|
return effectiveHint( aspect | QskAspect::Metric, status ).toReal();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMarginsF QskSkinnable::edgeMetrics( QskAspect::Subcontrol subControl,
|
void QskSkinnable::setMarginsHint( QskAspect::Aspect aspect, const QMarginsF& margins )
|
||||||
QskAspect::BoxPrimitive primitive ) const
|
{
|
||||||
|
m_data->hintTable.setMargins( aspect, margins );
|
||||||
|
}
|
||||||
|
|
||||||
|
QMarginsF QskSkinnable::marginsHint(
|
||||||
|
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||||
|
{
|
||||||
|
return effectiveHint( aspect | QskAspect::Metric, status ).value< QskMargins >();
|
||||||
|
}
|
||||||
|
|
||||||
|
QMarginsF QskSkinnable::borderMetrics( QskAspect::Subcontrol subControl ) const
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
|
|
||||||
const Aspect aspect = subControl | primitive;
|
const Aspect aspect = subControl | Border;
|
||||||
|
|
||||||
return QMarginsF(
|
return QMarginsF(
|
||||||
metric( aspect | LeftEdge ),
|
metric( aspect | LeftEdge ),
|
||||||
@ -523,28 +534,30 @@ static inline QMarginsF qskMarginsInner( const QskSkinnable* skinnable,
|
|||||||
qreal top = skinnable->metric( aspect | Border | TopEdge );
|
qreal top = skinnable->metric( aspect | Border | TopEdge );
|
||||||
qreal bottom = skinnable->metric( aspect | Border | BottomEdge );
|
qreal bottom = skinnable->metric( aspect | Border | BottomEdge );
|
||||||
|
|
||||||
|
const QMarginsF padding = skinnable->marginsHint( aspect | Padding );
|
||||||
|
|
||||||
const qreal w = size.width() - 0.5 * ( left + right );
|
const qreal w = size.width() - 0.5 * ( left + right );
|
||||||
const qreal h = size.height() - 0.5 * ( top + bottom );
|
const qreal h = size.height() - 0.5 * ( top + bottom );
|
||||||
|
|
||||||
left += qskMax(
|
left += qskMax(
|
||||||
qskPaddingInner( skinnable, aspect | RadiusX | TopLeftCorner, w ),
|
qskPaddingInner( skinnable, aspect | RadiusX | TopLeftCorner, w ),
|
||||||
qskPaddingInner( skinnable, aspect | RadiusX | BottomLeftCorner, w ),
|
qskPaddingInner( skinnable, aspect | RadiusX | BottomLeftCorner, w ),
|
||||||
(qreal) skinnable->metric( aspect | Padding | LeftEdge ) );
|
padding.left() );
|
||||||
|
|
||||||
right += qskMax(
|
right += qskMax(
|
||||||
qskPaddingInner( skinnable, aspect | RadiusX | TopRightCorner, w ),
|
qskPaddingInner( skinnable, aspect | RadiusX | TopRightCorner, w ),
|
||||||
qskPaddingInner( skinnable, aspect | RadiusX | BottomRightCorner, w ),
|
qskPaddingInner( skinnable, aspect | RadiusX | BottomRightCorner, w ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | RightEdge ) );
|
padding.right() );
|
||||||
|
|
||||||
top += qskMax(
|
top += qskMax(
|
||||||
qskPaddingInner( skinnable, aspect | RadiusY | TopLeftCorner, h ),
|
qskPaddingInner( skinnable, aspect | RadiusY | TopLeftCorner, h ),
|
||||||
qskPaddingInner( skinnable, aspect | RadiusY | TopRightCorner, h ),
|
qskPaddingInner( skinnable, aspect | RadiusY | TopRightCorner, h ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | TopEdge ) );
|
padding.top() );
|
||||||
|
|
||||||
bottom += qskMax(
|
bottom += qskMax(
|
||||||
qskPaddingInner( skinnable, aspect | RadiusY | BottomLeftCorner, h ),
|
qskPaddingInner( skinnable, aspect | RadiusY | BottomLeftCorner, h ),
|
||||||
qskPaddingInner( skinnable, aspect | RadiusY | BottomRightCorner, h ),
|
qskPaddingInner( skinnable, aspect | RadiusY | BottomRightCorner, h ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | BottomEdge ) );
|
padding.bottom() );
|
||||||
|
|
||||||
return QMarginsF( left, top, right, bottom );
|
return QMarginsF( left, top, right, bottom );
|
||||||
}
|
}
|
||||||
@ -561,28 +574,30 @@ static inline QMarginsF qskMarginsOuter( const QskSkinnable* skinnable,
|
|||||||
qreal top = skinnable->metric( aspect | Border | TopEdge );
|
qreal top = skinnable->metric( aspect | Border | TopEdge );
|
||||||
qreal bottom = skinnable->metric( aspect | Border | BottomEdge );
|
qreal bottom = skinnable->metric( aspect | Border | BottomEdge );
|
||||||
|
|
||||||
|
const QMarginsF padding = skinnable->marginsHint( aspect | Padding );
|
||||||
|
|
||||||
const qreal w = size.width() + 0.5 * ( left + right );
|
const qreal w = size.width() + 0.5 * ( left + right );
|
||||||
const qreal h = size.height() + 0.5 * ( top + bottom );
|
const qreal h = size.height() + 0.5 * ( top + bottom );
|
||||||
|
|
||||||
left += qskMax(
|
left += qskMax(
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusX | TopLeftCorner, w ),
|
qskPaddingOuter( skinnable, aspect | RadiusX | TopLeftCorner, w ),
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusX | BottomLeftCorner, w ),
|
qskPaddingOuter( skinnable, aspect | RadiusX | BottomLeftCorner, w ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | LeftEdge ) );
|
padding.left() );
|
||||||
|
|
||||||
right += qskMax(
|
right += qskMax(
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusX | TopRightCorner, w ),
|
qskPaddingOuter( skinnable, aspect | RadiusX | TopRightCorner, w ),
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusX | BottomRightCorner, w ),
|
qskPaddingOuter( skinnable, aspect | RadiusX | BottomRightCorner, w ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | RightEdge ) );
|
padding.right() );
|
||||||
|
|
||||||
top += qskMax(
|
top += qskMax(
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusY | TopLeftCorner, h ),
|
qskPaddingOuter( skinnable, aspect | RadiusY | TopLeftCorner, h ),
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusY | TopRightCorner, h ),
|
qskPaddingOuter( skinnable, aspect | RadiusY | TopRightCorner, h ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | TopEdge ) );
|
padding.top() );
|
||||||
|
|
||||||
bottom += qskMax(
|
bottom += qskMax(
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusY | BottomLeftCorner, h ),
|
qskPaddingOuter( skinnable, aspect | RadiusY | BottomLeftCorner, h ),
|
||||||
qskPaddingOuter( skinnable, aspect | RadiusY | BottomRightCorner, h ),
|
qskPaddingOuter( skinnable, aspect | RadiusY | BottomRightCorner, h ),
|
||||||
(qreal)skinnable->metric( aspect | Padding | BottomEdge ) );
|
padding.bottom() );
|
||||||
|
|
||||||
return QMargins( left, top, right, bottom );
|
return QMargins( left, top, right, bottom );
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,15 @@ public:
|
|||||||
void setMetric( QskAspect::Aspect, qreal metric );
|
void setMetric( QskAspect::Aspect, qreal metric );
|
||||||
qreal metric( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
qreal metric( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||||
|
|
||||||
|
void setMarginsHint( QskAspect::Aspect, const QMarginsF& );
|
||||||
|
QMarginsF marginsHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||||
|
|
||||||
void setFlagHint( QskAspect::Aspect, int flag );
|
void setFlagHint( QskAspect::Aspect, int flag );
|
||||||
int flagHint( QskAspect::Aspect ) const;
|
int flagHint( QskAspect::Aspect ) const;
|
||||||
|
|
||||||
template< typename T > T flagHint( QskAspect::Aspect, T = T() ) const;
|
template< typename T > T flagHint( QskAspect::Aspect, T = T() ) const;
|
||||||
|
|
||||||
QMarginsF edgeMetrics( QskAspect::Subcontrol, QskAspect::BoxPrimitive ) const;
|
QMarginsF borderMetrics( QskAspect::Subcontrol ) const;
|
||||||
|
|
||||||
void setFontRole( QskAspect::Aspect, int role );
|
void setFontRole( QskAspect::Aspect, int role );
|
||||||
int fontRole( QskAspect::Aspect ) const;
|
int fontRole( QskAspect::Aspect ) const;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
static QMarginsF qskMargins(
|
static QMarginsF qskMargins(
|
||||||
const QskSlider* slider, QskAspect::Subcontrol subControl )
|
const QskSlider* slider, QskAspect::Subcontrol subControl )
|
||||||
{
|
{
|
||||||
QMarginsF m = slider->edgeMetrics( subControl, QskAspect::Margin );
|
QMarginsF m = slider->marginsHint( subControl | QskAspect::Margin );
|
||||||
|
|
||||||
if ( slider->orientation() == Qt::Vertical )
|
if ( slider->orientation() == Qt::Vertical )
|
||||||
m = QMarginsF( m.top(), m.right(), m.bottom(), m.left() );
|
m = QMarginsF( m.top(), m.right(), m.bottom(), m.left() );
|
||||||
@ -26,8 +26,8 @@ static QMarginsF qskMargins(
|
|||||||
static QMarginsF qskPadding(
|
static QMarginsF qskPadding(
|
||||||
const QskSlider* slider, QskAspect::Subcontrol subControl )
|
const QskSlider* slider, QskAspect::Subcontrol subControl )
|
||||||
{
|
{
|
||||||
QMarginsF m = slider->edgeMetrics( subControl, QskAspect::Padding )
|
QMarginsF m = slider->marginsHint( subControl | QskAspect::Padding )
|
||||||
+ slider->edgeMetrics( subControl, QskAspect::Border );
|
+ slider->borderMetrics( subControl );
|
||||||
|
|
||||||
if ( slider->orientation() == Qt::Vertical )
|
if ( slider->orientation() == Qt::Vertical )
|
||||||
m = QMarginsF( m.top(), m.right(), m.bottom(), m.left() );
|
m = QMarginsF( m.top(), m.right(), m.bottom(), m.left() );
|
||||||
|
@ -134,12 +134,11 @@ qreal QskSubWindowSkinlet::titleBarHeight( const QskSubWindow* subWindow ) const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const QFontMetricsF fm( subWindow->effectiveFont( QskSubWindow::TitleBar ) );
|
const QFontMetricsF fm( subWindow->effectiveFont( QskSubWindow::TitleBar ) );
|
||||||
|
const QMarginsF margins = subWindow->marginsHint( QskSubWindow::TitleBar | Padding );
|
||||||
|
|
||||||
qreal height = fm.height()
|
const qreal height = fm.height() + margins.top() + margins.bottom();
|
||||||
+ subWindow->metric( QskSubWindow::TitleBar | Padding | TopEdge )
|
const qreal minHeight = subWindow->metric( QskSubWindow::TitleBar | MinimumHeight );
|
||||||
+ subWindow->metric( QskSubWindow::TitleBar | Padding | BottomEdge );
|
|
||||||
|
|
||||||
qreal minHeight = subWindow->metric( QskSubWindow::TitleBar | MinimumHeight );
|
|
||||||
return qMax( height, minHeight);
|
return qMax( height, minHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "QskVariantAnimator.h"
|
#include "QskVariantAnimator.h"
|
||||||
#include "QskColorFilter.h"
|
#include "QskColorFilter.h"
|
||||||
|
#include "QskMargins.h"
|
||||||
|
|
||||||
// Even if we don't use the standard Qt animation system we
|
// Even if we don't use the standard Qt animation system we
|
||||||
// use its registry of interpolators: why adding our own ...
|
// use its registry of interpolators: why adding our own ...
|
||||||
@ -16,6 +17,7 @@
|
|||||||
static void qskRegisterInterpolator()
|
static void qskRegisterInterpolator()
|
||||||
{
|
{
|
||||||
qRegisterAnimationInterpolator<QskColorFilter>( QskColorFilter::interpolate );
|
qRegisterAnimationInterpolator<QskColorFilter>( QskColorFilter::interpolate );
|
||||||
|
qRegisterAnimationInterpolator<QskMargins>( QskMargins::interpolate );
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_CONSTRUCTOR_FUNCTION( qskRegisterInterpolator )
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterInterpolator )
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QskFunctions.h>
|
#include <QskFunctions.h>
|
||||||
#include <QskRgbValue.h>
|
#include <QskRgbValue.h>
|
||||||
#include <QskAnimationHint.h>
|
#include <QskAnimationHint.h>
|
||||||
|
#include <QskMargins.h>
|
||||||
#include <QskSkinlet.h>
|
#include <QskSkinlet.h>
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
@ -149,7 +150,7 @@ void QskMaterialSkin::initCommonHints()
|
|||||||
|
|
||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
setMetric( Control | Padding, 4 );
|
setMargins( Control | Padding, 4 );
|
||||||
|
|
||||||
setColor( Control | Background, pal.baseColor );
|
setColor( Control | Background, pal.baseColor );
|
||||||
setColor( Control | Border, pal.darker200 );
|
setColor( Control | Border, pal.darker200 );
|
||||||
@ -189,7 +190,7 @@ void QskMaterialSkin::initFocusIndicatorHints()
|
|||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
setMetric( Q::Panel | Border, 2 );
|
setMetric( Q::Panel | Border, 2 );
|
||||||
setMetric( Q::Panel | Padding, 5 );
|
setMargins( Q::Panel | Padding, 5 );
|
||||||
setColor( Q::Panel | Border, pal.accentColor );
|
setColor( Q::Panel | Border, pal.accentColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +230,8 @@ void QskMaterialSkin::initPageIndicatorHints()
|
|||||||
setMetric( Q::Highlighted | Radius, 6 );
|
setMetric( Q::Highlighted | Radius, 6 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setMetric( Q::Panel | Margin, 0 );
|
setMargins( Q::Panel | Margin, 0 );
|
||||||
setMetric( Q::Panel | Padding, 0 );
|
setMargins( Q::Panel | Padding, 0 );
|
||||||
setMetric( Q::Panel | Border, 0 );
|
setMetric( Q::Panel | Border, 0 );
|
||||||
setColor( Q::Panel | Background, 0 );
|
setColor( Q::Panel | Background, 0 );
|
||||||
|
|
||||||
@ -250,16 +251,17 @@ void QskMaterialSkin::initPushButtonHints()
|
|||||||
setSkinHint( Q::Text | QskAspect::FontRole, ButtonFontRole );
|
setSkinHint( Q::Text | QskAspect::FontRole, ButtonFontRole );
|
||||||
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
||||||
|
|
||||||
|
const QskMargins margin( 4, 3 );
|
||||||
|
const QskMargins padding( 10, 6 );
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto aspect = Q::Panel;
|
const auto aspect = Q::Panel;
|
||||||
|
|
||||||
setMetric( aspect | Radius, 2.0f );
|
setMetric( aspect | Radius, 2 );
|
||||||
|
|
||||||
setMetric( aspect | Padding | HorizontalEdges, 6.0f );
|
setMargins( aspect | Margin, margin );
|
||||||
setMetric( aspect | Padding | VerticalEdges, 10.0f );
|
setMargins( aspect | Padding, padding );
|
||||||
|
setMargins( aspect | Shadow, 0 );
|
||||||
setMetric( aspect | Margin | HorizontalEdges, 3.0f );
|
|
||||||
setMetric( aspect | Margin | VerticalEdges, 4.5f );
|
|
||||||
|
|
||||||
setMetric( aspect | Spacing, 4 );
|
setMetric( aspect | Spacing, 4 );
|
||||||
}
|
}
|
||||||
@ -269,30 +271,20 @@ void QskMaterialSkin::initPushButtonHints()
|
|||||||
{
|
{
|
||||||
const auto aspect = Q::Panel | state;
|
const auto aspect = Q::Panel | state;
|
||||||
|
|
||||||
setMetric( aspect | Padding | TopEdge, 4.0f );
|
setMargins( aspect | Margin, margin.translated( 0, -margin.top() ) );
|
||||||
setMetric( aspect | Padding | BottomEdge, 8.0f );
|
setMargins( aspect | Padding, padding.translated( 0, -2 ) );
|
||||||
|
setMargins( aspect | Shadow, QskMargins( 4, -1.0, 4, 5.0 ) );
|
||||||
setMetric( aspect | Margin | TopEdge, 0.0f );
|
|
||||||
setMetric( aspect | Margin | BottomEdge, 6.0f );
|
|
||||||
|
|
||||||
setMetric( aspect | Shadow | VerticalEdges, 4.5f );
|
|
||||||
setMetric( aspect | Shadow | TopEdge, -1.0f );
|
|
||||||
setMetric( aspect | Shadow | BottomEdge, 5.0f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hover (or normal for touch)
|
|
||||||
for ( const auto state :
|
for ( const auto state :
|
||||||
{ Q::Hovered, Q::Checked | Q::Checkable
|
{ Q::Hovered, Q::Checked | Q::Checkable
|
||||||
| Q::Hovered, Q::Checkable | Q::Hovered } )
|
| Q::Hovered, Q::Checkable | Q::Hovered } )
|
||||||
{
|
{
|
||||||
const auto aspect = Q::Panel | Shadow | state;
|
const auto aspect = Q::Panel | state;
|
||||||
|
setMargins( aspect | Shadow, QskMargins( 2, 2, 2, 4 ) );
|
||||||
setMetric( aspect | VerticalEdges, 2.5f );
|
|
||||||
setMetric( aspect | TopEdge, 1.5f );
|
|
||||||
setMetric( aspect | BottomEdge, 3.0f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setMetric( Q::Panel | Q::Flat | Shadow, 0 );
|
setMargins( Q::Panel | Q::Flat | Shadow, 0 );
|
||||||
|
|
||||||
setAnimation( Q::Panel | Color, qskDuration );
|
setAnimation( Q::Panel | Color, qskDuration );
|
||||||
setAnimation( Q::Panel | Margin | Metric, qskDuration );
|
setAnimation( Q::Panel | Margin | Metric, qskDuration );
|
||||||
@ -355,27 +347,15 @@ void QskMaterialSkin::initDialogButtonHints()
|
|||||||
|
|
||||||
setMetric( Q::Panel | Radius, 2.0f );
|
setMetric( Q::Panel | Radius, 2.0f );
|
||||||
|
|
||||||
setMetric( Q::Panel | Padding | HorizontalEdges, 6.0f );
|
setMargins( Q::Panel | Margin, QskMargins( 3, 4.5 ) );
|
||||||
setMetric( Q::Panel | Padding | VerticalEdges, 10.0f );
|
setMargins( Q::Panel | Padding, QskMargins( 10, 6 ) );
|
||||||
|
|
||||||
setMetric( Q::Panel | Margin | HorizontalEdges, 3.0f );
|
|
||||||
setMetric( Q::Panel | Margin | VerticalEdges, 4.5f );
|
|
||||||
|
|
||||||
setMetric( Q::Panel | Spacing, 4 );
|
setMetric( Q::Panel | Spacing, 4 );
|
||||||
|
|
||||||
setMetric( Q::Panel | Q::Pressed | Padding | TopEdge, 4.0f );
|
setMargins( Q::Panel | Q::Pressed | Margin, QskMargins( 3, 0, 3, 6 ) );
|
||||||
setMetric( Q::Panel | Q::Pressed | Padding | BottomEdge, 8.0f );
|
setMargins( Q::Panel | Q::Pressed | Padding, QskMargins( 10, 4, 10, 8 ) );
|
||||||
|
setMargins( Q::Panel | Q::Pressed | Shadow, QskMargins( 4.5, -1, 4.5, 5 ) );
|
||||||
setMetric( Q::Panel | Q::Pressed | Margin | TopEdge, 0.0f );
|
setMargins( Q::Panel | Q::Hovered | Shadow, QskMargins( 2.5, 1.5, 2.5, 3 ) );
|
||||||
setMetric( Q::Panel | Q::Pressed | Margin | BottomEdge, 6.0f );
|
|
||||||
|
|
||||||
setMetric( Q::Panel | Q::Pressed | Shadow | VerticalEdges, 4.5f );
|
|
||||||
setMetric( Q::Panel | Q::Pressed | Shadow | TopEdge, -1.0f );
|
|
||||||
setMetric( Q::Panel | Q::Pressed | Shadow | BottomEdge, 5.0f );
|
|
||||||
|
|
||||||
setMetric( Q::Panel | Q::Hovered | Shadow | VerticalEdges, 2.5f );
|
|
||||||
setMetric( Q::Panel | Q::Hovered | Shadow | TopEdge, 1.5f );
|
|
||||||
setMetric( Q::Panel | Q::Hovered | Shadow | BottomEdge, 3.0f );
|
|
||||||
|
|
||||||
setAnimation( Q::Panel | Color, qskDuration );
|
setAnimation( Q::Panel | Color, qskDuration );
|
||||||
setAnimation( Q::Panel | Margin | Metric, qskDuration );
|
setAnimation( Q::Panel | Margin | Metric, qskDuration );
|
||||||
@ -414,12 +394,12 @@ void QskMaterialSkin::initSliderHints()
|
|||||||
|
|
||||||
setMetric( Q::Panel | Size, dim );
|
setMetric( Q::Panel | Size, dim );
|
||||||
setMetric( Q::Panel | Border, 0 );
|
setMetric( Q::Panel | Border, 0 );
|
||||||
setMetric( Q::Panel | Padding | VerticalEdges, 0.5 * dim );
|
setMargins( Q::Panel | Padding, QskMargins( 0.5 * dim, 0 ) );
|
||||||
|
|
||||||
for ( auto subControl : { Q::Groove, Q::Fill } )
|
for ( auto subControl : { Q::Groove, Q::Fill } )
|
||||||
{
|
{
|
||||||
setMetric( subControl | Border, 0 );
|
setMetric( subControl | Border, 0 );
|
||||||
setMetric( subControl | Padding, 0 );
|
setMargins( subControl | Padding, 0 );
|
||||||
setMetric( subControl | Size, 5 );
|
setMetric( subControl | Size, 5 );
|
||||||
setMetric( subControl | Radius, 0 );
|
setMetric( subControl | Radius, 0 );
|
||||||
}
|
}
|
||||||
@ -516,7 +496,7 @@ void QskMaterialSkin::initInputPanelHints()
|
|||||||
// frame
|
// frame
|
||||||
setMetric( Q::KeyFrame | Border, 2 );
|
setMetric( Q::KeyFrame | Border, 2 );
|
||||||
setMetric( Q::KeyFrame | Radius, 4 );
|
setMetric( Q::KeyFrame | Radius, 4 );
|
||||||
setMetric( Q::KeyFrame | Margin, 2 );
|
setMargins( Q::KeyFrame | Margin, 2 );
|
||||||
|
|
||||||
setColor( Q::KeyFrame, pal.baseColor );
|
setColor( Q::KeyFrame, pal.baseColor );
|
||||||
setColor( Q::KeyFrame | Q::Pressed, pal.accentColor );
|
setColor( Q::KeyFrame | Q::Pressed, pal.accentColor );
|
||||||
@ -556,7 +536,7 @@ void QskMaterialSkin::initScrollViewHints()
|
|||||||
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
|
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
|
||||||
{
|
{
|
||||||
setMetric( subControl | Size, 12 );
|
setMetric( subControl | Size, 12 );
|
||||||
setMetric( subControl | Padding, 0 );
|
setMargins( subControl | Padding, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
setMetric( Q::HorizontalScrollHandle | MinimumWidth, qskDpiScaled( 40.0 ) );
|
setMetric( Q::HorizontalScrollHandle | MinimumWidth, qskDpiScaled( 40.0 ) );
|
||||||
@ -564,7 +544,7 @@ void QskMaterialSkin::initScrollViewHints()
|
|||||||
|
|
||||||
for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } )
|
for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } )
|
||||||
{
|
{
|
||||||
setMetric( subControl | Margin, 0 );
|
setMargins( subControl | Margin, 0 );
|
||||||
setMetric( subControl | Radius, 3 );
|
setMetric( subControl | Radius, 3 );
|
||||||
setMetric( subControl | Border, 1 );
|
setMetric( subControl | Border, 1 );
|
||||||
|
|
||||||
@ -591,8 +571,7 @@ void QskMaterialSkin::initListViewHints()
|
|||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
// padding for each cell
|
// padding for each cell
|
||||||
setMetric( Q::Cell | Padding | HorizontalEdges, 8 );
|
setMargins( Q::Cell | Padding, QskMargins( 4, 8 ) );
|
||||||
setMetric( Q::Cell | Padding | VerticalEdges, 4 );
|
|
||||||
|
|
||||||
setAnimation( Q::CellSelected | Color, qskDuration );
|
setAnimation( Q::CellSelected | Color, qskDuration );
|
||||||
setAnimation( Q::TextSelected | Color, qskDuration );
|
setAnimation( Q::TextSelected | Color, qskDuration );
|
||||||
@ -616,7 +595,7 @@ void QskMaterialSkin::initSubWindowHints()
|
|||||||
// panel
|
// panel
|
||||||
|
|
||||||
setMetric( Q::Panel | Border, 2 );
|
setMetric( Q::Panel | Border, 2 );
|
||||||
setMetric( Q::Panel | Padding, 10 );
|
setMargins( Q::Panel | Padding, 10 );
|
||||||
|
|
||||||
setColor( Q::Panel | Border | LeftEdge | TopEdge, pal.lighter125 );
|
setColor( Q::Panel | Border | LeftEdge | TopEdge, pal.lighter125 );
|
||||||
setColor( Q::Panel | Border | RightEdge | BottomEdge, pal.darker200 );
|
setColor( Q::Panel | Border | RightEdge | BottomEdge, pal.darker200 );
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QskFunctions.h>
|
#include <QskFunctions.h>
|
||||||
#include <QskRgbValue.h>
|
#include <QskRgbValue.h>
|
||||||
#include <QskAnimationHint.h>
|
#include <QskAnimationHint.h>
|
||||||
|
#include <QskMargins.h>
|
||||||
#include <QskSkinlet.h>
|
#include <QskSkinlet.h>
|
||||||
|
|
||||||
static const int qskDuration = 200;
|
static const int qskDuration = 200;
|
||||||
@ -173,7 +174,7 @@ void QskSquiekSkin::initCommonHints()
|
|||||||
|
|
||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
setMetric( Control | Padding, 4 );
|
setMargins( Control | Padding, 4 );
|
||||||
|
|
||||||
setColor( Control | Background, pal.lighter135 );
|
setColor( Control | Background, pal.lighter135 );
|
||||||
setColor( Control | Border, pal.darker200 );
|
setColor( Control | Border, pal.darker200 );
|
||||||
@ -210,7 +211,7 @@ void QskSquiekSkin::initFocusIndicatorHints()
|
|||||||
|
|
||||||
setMetric( Q::Panel | Border, 2 );
|
setMetric( Q::Panel | Border, 2 );
|
||||||
setMetric( Q::Panel | Radius, 4 );
|
setMetric( Q::Panel | Radius, 4 );
|
||||||
setMetric( Q::Panel | Padding, 5 );
|
setMargins( Q::Panel | Padding, 5 );
|
||||||
|
|
||||||
setColor( Q::Panel | Border, pal.highlighted );
|
setColor( Q::Panel | Border, pal.highlighted );
|
||||||
}
|
}
|
||||||
@ -242,8 +243,8 @@ void QskSquiekSkin::initPageIndicatorHints()
|
|||||||
setMetric( Q::Highlighted | Size, 8 );
|
setMetric( Q::Highlighted | Size, 8 );
|
||||||
setMetric( Q::Highlighted | Radius, 4 );
|
setMetric( Q::Highlighted | Radius, 4 );
|
||||||
|
|
||||||
setMetric( Q::Panel | Margin, 0 );
|
setMargins( Q::Panel | Margin, 0 );
|
||||||
setMetric( Q::Panel | Padding, 0 );
|
setMargins( Q::Panel | Padding, 0 );
|
||||||
setMetric( Q::Panel | Border, 0 );
|
setMetric( Q::Panel | Border, 0 );
|
||||||
setColor( Q::Panel | Background, 0 );
|
setColor( Q::Panel | Background, 0 );
|
||||||
|
|
||||||
@ -264,7 +265,7 @@ void QskSquiekSkin::initPushButtonHints()
|
|||||||
setMetric( Q::Panel | Border | HorizontalEdges, 2 );
|
setMetric( Q::Panel | Border | HorizontalEdges, 2 );
|
||||||
setMetric( Q::Panel | Border | VerticalEdges, 1 );
|
setMetric( Q::Panel | Border | VerticalEdges, 1 );
|
||||||
|
|
||||||
setMetric( Q::Panel | Padding, 10 );
|
setMargins( Q::Panel | Padding, 10 );
|
||||||
setMetric( Q::Panel | Spacing, 4 );
|
setMetric( Q::Panel | Spacing, 4 );
|
||||||
|
|
||||||
setSkinHint( Q::Text | Q::Disabled | Style, Qsk::Sunken );
|
setSkinHint( Q::Text | Q::Disabled | Style, Qsk::Sunken );
|
||||||
@ -307,7 +308,7 @@ void QskSquiekSkin::initDialogButtonHints()
|
|||||||
setMetric( Q::Panel | Border | HorizontalEdges, 2 );
|
setMetric( Q::Panel | Border | HorizontalEdges, 2 );
|
||||||
setMetric( Q::Panel | Border | VerticalEdges, 1 );
|
setMetric( Q::Panel | Border | VerticalEdges, 1 );
|
||||||
|
|
||||||
setMetric( Q::Panel | Padding, 10 );
|
setMargins( Q::Panel | Padding, 10 );
|
||||||
setMetric( Q::Panel | Spacing, 4 );
|
setMetric( Q::Panel | Spacing, 4 );
|
||||||
|
|
||||||
setMetric( Q::Panel | MinimumWidth, qskDpiScaled( 75.0 ) );
|
setMetric( Q::Panel | MinimumWidth, qskDpiScaled( 75.0 ) );
|
||||||
@ -339,23 +340,15 @@ void QskSquiekSkin::initTabButtonHints()
|
|||||||
|
|
||||||
setMetric( Q::Panel | Radius | TopCorners, 3 );
|
setMetric( Q::Panel | Radius | TopCorners, 3 );
|
||||||
setMetric( Q::Panel | Border | LeftEdge | TopEdge | RightEdge, 1 );
|
setMetric( Q::Panel | Border | LeftEdge | TopEdge | RightEdge, 1 );
|
||||||
setMetric( Q::Panel | Padding | VerticalEdges, 10 );
|
setMargins( Q::Panel | Padding, QskMargins( 10, 4 ) );
|
||||||
setMetric( Q::Panel | Padding | HorizontalEdges, 4 );
|
|
||||||
setMetric( Q::Panel | MinimumWidth, 30 );
|
setMetric( Q::Panel | MinimumWidth, 30 );
|
||||||
setMetric( Q::Panel | MinimumHeight, 16 );
|
setMetric( Q::Panel | MinimumHeight, 16 );
|
||||||
|
|
||||||
for ( const auto state : { NoState } )
|
for ( const auto state : { NoState } )
|
||||||
{
|
setMargins( Q::Panel | Margin | state, QskMargins( -1, 2, -1, 0 ) );
|
||||||
setMetric( Q::Panel | Margin | TopEdge | state, 2 );
|
|
||||||
setMetric( Q::Panel | Margin | BottomEdge | state, 0 );
|
|
||||||
setMetric( Q::Panel | Margin | VerticalEdges | state, -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
||||||
{
|
setMargins( Q::Panel | Margin | state, QskMargins( -1, 0, -1, -1 ) );
|
||||||
setMetric( Q::Panel | Margin | TopEdge | state, 0 );
|
|
||||||
setMetric( Q::Panel | Margin | BottomEdge | state, -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
||||||
#if 0
|
#if 0
|
||||||
@ -393,13 +386,12 @@ void QskSquiekSkin::initSliderHints()
|
|||||||
setMetric( Q::Panel | Size, dim );
|
setMetric( Q::Panel | Size, dim );
|
||||||
setMetric( Q::Panel | Border, 0 );
|
setMetric( Q::Panel | Border, 0 );
|
||||||
|
|
||||||
setMetric( Q::Panel | Padding | HorizontalEdges, 0 );
|
setMargins( Q::Panel | Padding, QskMargins( 0.5 * dim, 0 ) );
|
||||||
setMetric( Q::Panel | Padding | VerticalEdges, 0.5 * dim );
|
|
||||||
|
|
||||||
for ( auto subControl : { Q::Groove, Q::Fill } )
|
for ( auto subControl : { Q::Groove, Q::Fill } )
|
||||||
{
|
{
|
||||||
setMetric( subControl | Border, 0 );
|
setMetric( subControl | Border, 0 );
|
||||||
setMetric( subControl | Padding, 0 );
|
setMargins( subControl | Padding, 0 );
|
||||||
setMetric( subControl | Size, 0.3 * dim );
|
setMetric( subControl | Size, 0.3 * dim );
|
||||||
setMetric( subControl | Radius, 0.1 * dim );
|
setMetric( subControl | Radius, 0.1 * dim );
|
||||||
}
|
}
|
||||||
@ -427,8 +419,11 @@ void QskSquiekSkin::initTabBarHints()
|
|||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
using Q = QskTabBar;
|
using Q = QskTabBar;
|
||||||
|
|
||||||
for ( auto aspect : { Radius, Border, Padding, Margin } )
|
setMetric( Q::Panel | Radius, 0 );
|
||||||
setMetric( Q::Panel | aspect, 0 );
|
setMetric( Q::Panel | Border, 0 );
|
||||||
|
|
||||||
|
setMargins( Q::Panel | Margin, 0 );
|
||||||
|
setMargins( Q::Panel | Padding, 0 );
|
||||||
|
|
||||||
setColor( Q::Panel | Background, 0 );
|
setColor( Q::Panel | Background, 0 );
|
||||||
}
|
}
|
||||||
@ -461,7 +456,7 @@ void QskSquiekSkin::initInputPanelHints()
|
|||||||
// frame
|
// frame
|
||||||
setMetric( Q::KeyFrame | Border, 2 );
|
setMetric( Q::KeyFrame | Border, 2 );
|
||||||
setMetric( Q::KeyFrame | Radius, 4 );
|
setMetric( Q::KeyFrame | Radius, 4 );
|
||||||
setMetric( Q::KeyFrame | Margin, 2 );
|
setMargins( Q::KeyFrame | Margin, 2 );
|
||||||
|
|
||||||
setAnimation( Q::KeyFrame | Color, qskDuration );
|
setAnimation( Q::KeyFrame | Color, qskDuration );
|
||||||
setAnimation( Q::KeyFrame | Color | Border, qskDuration );
|
setAnimation( Q::KeyFrame | Color | Border, qskDuration );
|
||||||
@ -494,13 +489,13 @@ void QskSquiekSkin::initScrollViewHints()
|
|||||||
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
|
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
|
||||||
{
|
{
|
||||||
setMetric( subControl | Size, 8 );
|
setMetric( subControl | Size, 8 );
|
||||||
setMetric( subControl | Padding, 0 );
|
setMargins( subControl | Padding, 0 );
|
||||||
setMetric( subControl | Margin, 0 );
|
setMargins( subControl | Margin, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } )
|
for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } )
|
||||||
{
|
{
|
||||||
setMetric( subControl | Margin, 0 );
|
setMargins( subControl | Margin, 0 );
|
||||||
setMetric( subControl | Radius, 3 );
|
setMetric( subControl | Radius, 3 );
|
||||||
setMetric( subControl | Border, 1 );
|
setMetric( subControl | Border, 1 );
|
||||||
|
|
||||||
@ -523,8 +518,7 @@ void QskSquiekSkin::initListViewHints()
|
|||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
// padding for each cell
|
// padding for each cell
|
||||||
setMetric( Q::Cell | Padding | HorizontalEdges, 8 );
|
setMargins( Q::Cell | Padding, QskMargins( 4, 8 ) );
|
||||||
setMetric( Q::Cell | Padding | VerticalEdges, 4 );
|
|
||||||
|
|
||||||
setAnimation( Q::CellSelected | Color, qskDuration );
|
setAnimation( Q::CellSelected | Color, qskDuration );
|
||||||
setAnimation( Q::TextSelected | Color, qskDuration );
|
setAnimation( Q::TextSelected | Color, qskDuration );
|
||||||
@ -544,7 +538,7 @@ void QskSquiekSkin::initSubWindowHints()
|
|||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
setMetric( Q::Panel | Border, 2 );
|
setMetric( Q::Panel | Border, 2 );
|
||||||
setMetric( Q::Panel | Padding, 10 );
|
setMargins( Q::Panel | Padding, 10 );
|
||||||
setMetric( Q::TitleBar | Border, 2 );
|
setMetric( Q::TitleBar | Border, 2 );
|
||||||
|
|
||||||
setSkinHint( Q::TitleBar | FontRole, int( QskSkin::TinyFont ) );
|
setSkinHint( Q::TitleBar | FontRole, int( QskSkin::TinyFont ) );
|
||||||
|
@ -37,6 +37,7 @@ HEADERS += \
|
|||||||
common/QskFunctions.h \
|
common/QskFunctions.h \
|
||||||
common/QskGlobal.h \
|
common/QskGlobal.h \
|
||||||
common/QskGradient.h \
|
common/QskGradient.h \
|
||||||
|
common/QskMargins.h \
|
||||||
common/QskModule.h \
|
common/QskModule.h \
|
||||||
common/QskNamespace.h \
|
common/QskNamespace.h \
|
||||||
common/QskObjectCounter.h \
|
common/QskObjectCounter.h \
|
||||||
@ -49,6 +50,7 @@ SOURCES += \
|
|||||||
common/QskCorner.cpp \
|
common/QskCorner.cpp \
|
||||||
common/QskFunctions.cpp \
|
common/QskFunctions.cpp \
|
||||||
common/QskGradient.cpp \
|
common/QskGradient.cpp \
|
||||||
|
common/QskMargins.cpp \
|
||||||
common/QskModule.cpp \
|
common/QskModule.cpp \
|
||||||
common/QskObjectCounter.cpp \
|
common/QskObjectCounter.cpp \
|
||||||
common/QskSizePolicy.cpp \
|
common/QskSizePolicy.cpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user