beautified
This commit is contained in:
parent
8010d70e4a
commit
ca2cdf7663
|
@ -84,9 +84,9 @@ inline bool QskArcMetrics::operator==(
|
||||||
const QskArcMetrics& other ) const noexcept
|
const QskArcMetrics& other ) const noexcept
|
||||||
{
|
{
|
||||||
return ( qskFuzzyCompare( m_width, other.m_width )
|
return ( qskFuzzyCompare( m_width, other.m_width )
|
||||||
&& qskFuzzyCompare( m_startAngle, other.m_startAngle )
|
&& qskFuzzyCompare( m_startAngle, other.m_startAngle )
|
||||||
&& qskFuzzyCompare( m_spanAngle, other.m_spanAngle )
|
&& qskFuzzyCompare( m_spanAngle, other.m_spanAngle )
|
||||||
&& m_sizeMode == other.m_sizeMode );
|
&& m_sizeMode == other.m_sizeMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool QskArcMetrics::operator!=(
|
inline bool QskArcMetrics::operator!=(
|
||||||
|
|
|
@ -145,7 +145,7 @@ static inline QskGradientStops qskExtractedStops(
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto color =
|
const auto color =
|
||||||
QskGradientStop::interpolated( stops[i-1], stops[i], from );
|
QskGradientStop::interpolated( stops[i - 1], stops[i], from );
|
||||||
|
|
||||||
extracted += QskGradientStop( 0.0, color );
|
extracted += QskGradientStop( 0.0, color );
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ static inline QskGradientStops qskExtractedStops(
|
||||||
extracted += QskGradientStop( pos, s.color() );
|
extracted += QskGradientStop( pos, s.color() );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto color = QskGradientStop::interpolated( stops[i-1], stops[i], to );
|
const auto color = QskGradientStop::interpolated( stops[i - 1], stops[i], to );
|
||||||
extracted += QskGradientStop( 1.0, color );
|
extracted += QskGradientStop( 1.0, color );
|
||||||
|
|
||||||
return extracted;
|
return extracted;
|
||||||
|
@ -370,7 +370,7 @@ bool QskGradient::hasStopAt( qreal value ) const
|
||||||
|
|
||||||
uint QskGradient::hash( uint seed ) const
|
uint QskGradient::hash( uint seed ) const
|
||||||
{
|
{
|
||||||
if ( m_stops.isEmpty() )
|
if ( m_stops.isEmpty() )
|
||||||
return seed;
|
return seed;
|
||||||
|
|
||||||
uint hash = qHashBits( &m_orientation, sizeof( m_orientation ), seed );
|
uint hash = qHashBits( &m_orientation, sizeof( m_orientation ), seed );
|
||||||
|
|
|
@ -342,7 +342,7 @@ void QskObjectCounter::debugStatistics( QDebug debug, ObjectType objectType ) co
|
||||||
{
|
{
|
||||||
debug << "\tClass: " << object->metaObject()->className();
|
debug << "\tClass: " << object->metaObject()->className();
|
||||||
if ( !object->objectName().isEmpty() )
|
if ( !object->objectName().isEmpty() )
|
||||||
debug << " Name: " << object->objectName();
|
debug << " Name: " << object->objectName();
|
||||||
debug << '\n';
|
debug << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
#define RGB( color, weight ) color ## weight
|
#define RGB( color, weight ) color ## weight
|
||||||
|
|
||||||
#define RGBTABLE( c ) \
|
#define RGBTABLE( c ) \
|
||||||
{ \
|
{ \
|
||||||
RGB( c, 50 ), RGB( c, 100 ), RGB( c, 200 ), RGB( c, 300 ), RGB( c, 400 ), \
|
RGB( c, 50 ), RGB( c, 100 ), RGB( c, 200 ), RGB( c, 300 ), RGB( c, 400 ), \
|
||||||
RGB( c, 500 ), RGB( c, 600 ), RGB( c, 700 ), RGB( c, 800 ), RGB( c, 900 ) \
|
RGB( c, 500 ), RGB( c, 600 ), RGB( c, 700 ), RGB( c, 800 ), RGB( c, 900 ) \
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ static QskGradientStops qskColorStops(
|
||||||
for ( int i = 1; i < count; i++ )
|
for ( int i = 1; i < count; i++ )
|
||||||
{
|
{
|
||||||
const qreal pos = i * step;
|
const qreal pos = i * step;
|
||||||
stops += QskGradientStop( pos, rgb[i-1] );
|
stops += QskGradientStop( pos, rgb[i - 1] );
|
||||||
stops += QskGradientStop( pos, rgb[i] );
|
stops += QskGradientStop( pos, rgb[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ QSizeF QskGraphicLabelSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
constexpr qreal max = std::numeric_limits< int >::max();
|
constexpr qreal max = std::numeric_limits< int >::max();
|
||||||
|
|
||||||
QRectF r( 0.0, 0.0, max, max );
|
QRectF r( 0.0, 0.0, max, max );
|
||||||
|
|
||||||
if ( constraint.width() >= 0.0 )
|
if ( constraint.width() >= 0.0 )
|
||||||
r.setWidth( constraint.width() );
|
r.setWidth( constraint.width() );
|
||||||
else
|
else
|
||||||
|
@ -164,7 +164,7 @@ QSizeF QskGraphicLabelSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
|
|
||||||
if ( constraint.width() >= 0.0 )
|
if ( constraint.width() >= 0.0 )
|
||||||
hint.setHeight( innerConstraint.width() / aspectRatio );
|
hint.setHeight( innerConstraint.width() / aspectRatio );
|
||||||
else
|
else
|
||||||
hint.setWidth( innerConstraint.height() * aspectRatio );
|
hint.setWidth( innerConstraint.height() * aspectRatio );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -437,7 +437,7 @@ QSGNode* QskListViewSkinlet::updateCellNode( const QskListView* listView,
|
||||||
QskAspect::States rowStates;
|
QskAspect::States rowStates;
|
||||||
if ( row == listView->selectedRow() )
|
if ( row == listView->selectedRow() )
|
||||||
rowStates |= QskListView::Selected;
|
rowStates |= QskListView::Selected;
|
||||||
|
|
||||||
QskSkinStateChanger stateChanger( listView, rowStates );
|
QskSkinStateChanger stateChanger( listView, rowStates );
|
||||||
|
|
||||||
QSGNode* newNode = nullptr;
|
QSGNode* newNode = nullptr;
|
||||||
|
|
|
@ -17,15 +17,15 @@ QSK_SYSTEM_STATE( QskMenu, Selected, QskAspect::FirstSystemState << 2 )
|
||||||
|
|
||||||
class QskMenu::PrivateData
|
class QskMenu::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QVector< Entry > entries;
|
QVector< Entry > entries;
|
||||||
QVector< QskGraphic > icons;
|
QVector< QskGraphic > icons;
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
QskTextOptions textOptions;
|
||||||
QPointF origin;
|
QPointF origin;
|
||||||
|
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
bool isPressed = false;
|
bool isPressed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
QskMenu::QskMenu( QQuickItem* parent )
|
QskMenu::QskMenu( QQuickItem* parent )
|
||||||
|
@ -48,14 +48,14 @@ QskMenu::~QskMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskMenu::setOrigin( const QPointF& origin )
|
void QskMenu::setOrigin( const QPointF& origin )
|
||||||
{
|
{
|
||||||
if ( origin != m_data->origin )
|
if ( origin != m_data->origin )
|
||||||
{
|
{
|
||||||
m_data->origin = origin;
|
m_data->origin = origin;
|
||||||
Q_EMIT originChanged( origin );
|
Q_EMIT originChanged( origin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF QskMenu::origin() const
|
QPointF QskMenu::origin() const
|
||||||
{
|
{
|
||||||
return m_data->origin;
|
return m_data->origin;
|
||||||
|
@ -275,7 +275,7 @@ void QskMenu::mouseReleaseEvent( QMouseEvent* event )
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskMenu::aboutToShow()
|
void QskMenu::aboutToShow()
|
||||||
{
|
{
|
||||||
setGeometry( QRectF( m_data->origin, sizeConstraint() ) );
|
setGeometry( QRectF( m_data->origin, sizeConstraint() ) );
|
||||||
Inherited::aboutToShow();
|
Inherited::aboutToShow();
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ void QskMenu::setSelectedIndex( int index )
|
||||||
|
|
||||||
if ( index >= 0 )
|
if ( index >= 0 )
|
||||||
setCurrentIndex( index );
|
setCurrentIndex( index );
|
||||||
|
|
||||||
Q_EMIT triggered( index );
|
Q_EMIT triggered( index );
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ class QSK_EXPORT QskMenu : public QskPopup
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( QPointF origin READ origin
|
Q_PROPERTY( QPointF origin READ origin
|
||||||
WRITE setOrigin NOTIFY originChanged )
|
WRITE setOrigin NOTIFY originChanged )
|
||||||
|
|
||||||
Q_PROPERTY( int count READ count )
|
Q_PROPERTY( int count READ count )
|
||||||
|
|
||||||
Q_PROPERTY( int currentIndex READ currentIndex
|
Q_PROPERTY( int currentIndex READ currentIndex
|
||||||
WRITE setCurrentIndex NOTIFY currentIndexChanged )
|
WRITE setCurrentIndex NOTIFY currentIndexChanged )
|
||||||
|
|
||||||
using Inherited = QskPopup;
|
using Inherited = QskPopup;
|
||||||
|
|
||||||
|
|
|
@ -52,19 +52,19 @@ static QSizeF qskIconSize( const QskMenu* menu )
|
||||||
const auto hint = menu->strutSizeHint( QskMenu::Graphic );
|
const auto hint = menu->strutSizeHint( QskMenu::Graphic );
|
||||||
const qreal textHeight = QFontMetrics(
|
const qreal textHeight = QFontMetrics(
|
||||||
menu->effectiveFont( QskMenu::Text ) ).height();
|
menu->effectiveFont( QskMenu::Text ) ).height();
|
||||||
|
|
||||||
const auto h = qMax( hint.height(), textHeight );
|
const auto h = qMax( hint.height(), textHeight );
|
||||||
|
|
||||||
qreal maxW = 0.0;
|
qreal maxW = 0.0;
|
||||||
for ( int i = 0; i < menu->count(); i++ )
|
for ( int i = 0; i < menu->count(); i++ )
|
||||||
{
|
{
|
||||||
const auto w = menu->graphicAt( i ).widthForHeight( h );
|
const auto w = menu->graphicAt( i ).widthForHeight( h );
|
||||||
if( w > maxW )
|
if( w > maxW )
|
||||||
maxW = w;
|
maxW = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto w = qMax( hint.width(), maxW );
|
const auto w = qMax( hint.width(), maxW );
|
||||||
|
|
||||||
return QSizeF( w, h );
|
return QSizeF( w, h );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ static QSGNode* qskUpdateTextNode( const QskMenu* menu,
|
||||||
QskMenu::Text, Qt::AlignVCenter | Qt::AlignLeft );
|
QskMenu::Text, Qt::AlignVCenter | Qt::AlignLeft );
|
||||||
|
|
||||||
return QskSkinlet::updateTextNode( menu, node, rect, alignment,
|
return QskSkinlet::updateTextNode( menu, node, rect, alignment,
|
||||||
text, menu->textOptions(), QskMenu::Text );
|
text, menu->textOptions(), QskMenu::Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
static QSGNode* qskUpdateBackgroundNode( const QskMenu*, QSGNode* )
|
static QSGNode* qskUpdateBackgroundNode( const QskMenu*, QSGNode* )
|
||||||
|
@ -213,7 +213,7 @@ static QSGNode* qskUpdateItemsNode( const QskMenu* menu, QSGNode* rootNode )
|
||||||
|
|
||||||
auto textRect = cellRect;
|
auto textRect = cellRect;
|
||||||
textRect.setX( graphicRect.right() + spacing );
|
textRect.setX( graphicRect.right() + spacing );
|
||||||
|
|
||||||
qskUpdateItemNode( menu, graphicRect, menu->graphicAt( i ),
|
qskUpdateItemNode( menu, graphicRect, menu->graphicAt( i ),
|
||||||
textRect, menu->entryAt( i ).text, node );
|
textRect, menu->entryAt( i ).text, node );
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ QSGNode* QskMenuSkinlet::updateContentsNode(
|
||||||
{
|
{
|
||||||
newNode = qskUpdateItemsNode( menu, oldNode );
|
newNode = qskUpdateItemsNode( menu, oldNode );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSGNode::replaceChildNode( roles, role, contentsNode, oldNode, newNode );
|
QskSGNode::replaceChildNode( roles, role, contentsNode, oldNode, newNode );
|
||||||
|
|
|
@ -20,8 +20,8 @@ class QSK_EXPORT QskMenuSkinlet : public QskPopupSkinlet
|
||||||
Q_INVOKABLE QskMenuSkinlet( QskSkin* = nullptr );
|
Q_INVOKABLE QskMenuSkinlet( QskSkin* = nullptr );
|
||||||
~QskMenuSkinlet() = default;
|
~QskMenuSkinlet() = default;
|
||||||
|
|
||||||
QRectF subControlRect( const QskSkinnable*, const QRectF&,
|
QRectF subControlRect( const QskSkinnable*,
|
||||||
QskAspect::Subcontrol ) const override;
|
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||||
|
|
||||||
QSizeF sizeHint( const QskSkinnable*,
|
QSizeF sizeHint( const QskSkinnable*,
|
||||||
Qt::SizeHint, const QSizeF& ) const override;
|
Qt::SizeHint, const QSizeF& ) const override;
|
||||||
|
|
|
@ -144,7 +144,7 @@ QskPopup::QskPopup( QQuickItem* parent )
|
||||||
Unfortunatly derived classes can't use setAcceptedMouseButtons anymore.
|
Unfortunatly derived classes can't use setAcceptedMouseButtons anymore.
|
||||||
Need to think about a solution TODO ...
|
Need to think about a solution TODO ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Inherited::setAcceptedMouseButtons( Qt::AllButtons );
|
Inherited::setAcceptedMouseButtons( Qt::AllButtons );
|
||||||
Inherited::setWheelEnabled( true );
|
Inherited::setWheelEnabled( true );
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
Q_PROPERTY( bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL )
|
Q_PROPERTY( bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
|
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
|
||||||
WRITE setShape RESET resetShape NOTIFY shapeChanged )
|
WRITE setShape RESET resetShape NOTIFY shapeChanged )
|
||||||
|
|
||||||
using Inherited = QskAbstractButton;
|
using Inherited = QskAbstractButton;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ inline const QVariant* qskResolvedHint( QskAspect aspect,
|
||||||
We intend to remove the obscure mechanism of resolving a hint
|
We intend to remove the obscure mechanism of resolving a hint
|
||||||
by dropping the state bits ony by one in the future. Instead we
|
by dropping the state bits ony by one in the future. Instead we
|
||||||
will have methods in QskSkinHintTableEditor, that allow
|
will have methods in QskSkinHintTableEditor, that allow
|
||||||
to set combinations of states in one call.
|
to set combinations of states in one call.
|
||||||
*/
|
*/
|
||||||
if ( const auto topState = aspect.topState() )
|
if ( const auto topState = aspect.topState() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace
|
||||||
{
|
{
|
||||||
using StateInt = typename std::underlying_type< QskAspect::State >::type;
|
using StateInt = typename std::underlying_type< QskAspect::State >::type;
|
||||||
|
|
||||||
const auto count = qCountTrailingZeroBits( static_cast< StateInt >( mask ) );
|
const auto count = qCountTrailingZeroBits( static_cast< StateInt >( mask ) );
|
||||||
return static_cast< QskAspect::State >( 1 << count );
|
return static_cast< QskAspect::State >( 1 << count );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,19 +46,19 @@ namespace
|
||||||
inline bool removeHintStateMask(
|
inline bool removeHintStateMask(
|
||||||
QskSkinHintTable* table, QskAspect aspect,
|
QskSkinHintTable* table, QskAspect aspect,
|
||||||
bool noState, QskAspect::States states, QskAspect::States mask )
|
bool noState, QskAspect::States states, QskAspect::States mask )
|
||||||
{
|
{
|
||||||
if ( mask == 0 )
|
if ( mask == 0 )
|
||||||
{
|
{
|
||||||
if ( noState || states != 0 )
|
if ( noState || states != 0 )
|
||||||
return table->removeHint( aspect | states );
|
return table->removeHint( aspect | states );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto stateLow = lowestState( mask );
|
const auto stateLow = lowestState( mask );
|
||||||
|
|
||||||
mask &= ~stateLow;
|
mask &= ~stateLow;
|
||||||
|
|
||||||
bool ret = removeHintStateMask( table, aspect, noState, states, mask );
|
bool ret = removeHintStateMask( table, aspect, noState, states, mask );
|
||||||
ret |= removeHintStateMask( table, aspect, noState, states | stateLow, mask );
|
ret |= removeHintStateMask( table, aspect, noState, states | stateLow, mask );
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
#include <qsgsimplerectnode.h>
|
#include <qsgsimplerectnode.h>
|
||||||
|
|
||||||
static inline QRectF qskSceneAlignedRect( const QQuickItem* item , const QRectF& rect )
|
static inline QRectF qskSceneAlignedRect( const QQuickItem* item, const QRectF& rect )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Aligning rect according to scene coordinates, so that
|
Aligning rect according to scene coordinates, so that
|
||||||
|
@ -568,7 +568,7 @@ QSizeF QskSkinlet::hintWithoutConstraint(
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This method is useful in situations, where a hint has been calculated
|
This method is useful in situations, where a hint has been calculated
|
||||||
from a constraint and we want to return the calculated part only
|
from a constraint and we want to return the calculated part only
|
||||||
*/
|
*/
|
||||||
QSizeF h;
|
QSizeF h;
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ class QSK_EXPORT QskSkinlet
|
||||||
void replaceChildNode( quint8 nodeRole, QSGNode* parentNode,
|
void replaceChildNode( quint8 nodeRole, QSGNode* parentNode,
|
||||||
QSGNode* oldNode, QSGNode* newNode ) const;
|
QSGNode* oldNode, QSGNode* newNode ) const;
|
||||||
|
|
||||||
QSizeF hintWithoutConstraint(
|
QSizeF hintWithoutConstraint(
|
||||||
const QSizeF& hint, const QSizeF& constraint ) const;
|
const QSizeF& hint, const QSizeF& constraint ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -44,7 +44,7 @@ class QSK_EXPORT QskStatusIndicator : public QskControl
|
||||||
int status() const;
|
int status() const;
|
||||||
bool hasStatus( int status ) const;
|
bool hasStatus( int status ) const;
|
||||||
|
|
||||||
QList<int> statusList() const;
|
QList< int > statusList() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setStatus( int status );
|
void setStatus( int status );
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace
|
||||||
for ( int i = 0; i < buttons.count(); i++ )
|
for ( int i = 0; i < buttons.count(); i++ )
|
||||||
addItem( buttons[ i ] );
|
addItem( buttons[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ QskArcNode::~QskArcNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskArcNode::setArcData( const QRectF& rect, const QskArcMetrics& metrics,
|
void QskArcNode::setArcData( const QRectF& rect, const QskArcMetrics& metrics,
|
||||||
const QskGradient &gradient, QQuickWindow* window )
|
const QskGradient& gradient, QQuickWindow* window )
|
||||||
{
|
{
|
||||||
m_metrics = metrics;
|
m_metrics = metrics;
|
||||||
m_gradient = gradient;
|
m_gradient = gradient;
|
||||||
|
@ -23,7 +23,7 @@ void QskArcNode::setArcData( const QRectF& rect, const QskArcMetrics& metrics,
|
||||||
update( window, QskTextureRenderer::AutoDetect, rect.toRect() );
|
update( window, QskTextureRenderer::AutoDetect, rect.toRect() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskArcNode::paint( QPainter* painter, const QSizeF &size )
|
void QskArcNode::paint( QPainter* painter, const QSizeF& size )
|
||||||
{
|
{
|
||||||
const qreal w = m_metrics.width();
|
const qreal w = m_metrics.width();
|
||||||
const QRectF rect( 0.5 * w, 0.5 * w, size.width() - w, size.height() - w );
|
const QRectF rect( 0.5 * w, 0.5 * w, size.width() - w, size.height() - w );
|
||||||
|
|
Loading…
Reference in New Issue