beautified

This commit is contained in:
Uwe Rathmann 2021-12-23 19:05:59 +01:00
parent 8010d70e4a
commit ca2cdf7663
19 changed files with 56 additions and 56 deletions

View File

@ -84,9 +84,9 @@ inline bool QskArcMetrics::operator==(
const QskArcMetrics& other ) const noexcept
{
return ( qskFuzzyCompare( m_width, other.m_width )
&& qskFuzzyCompare( m_startAngle, other.m_startAngle )
&& qskFuzzyCompare( m_spanAngle, other.m_spanAngle )
&& m_sizeMode == other.m_sizeMode );
&& qskFuzzyCompare( m_startAngle, other.m_startAngle )
&& qskFuzzyCompare( m_spanAngle, other.m_spanAngle )
&& m_sizeMode == other.m_sizeMode );
}
inline bool QskArcMetrics::operator!=(

View File

@ -145,7 +145,7 @@ static inline QskGradientStops qskExtractedStops(
}
const auto color =
QskGradientStop::interpolated( stops[i-1], stops[i], from );
QskGradientStop::interpolated( stops[i - 1], stops[i], from );
extracted += QskGradientStop( 0.0, color );
}
@ -161,7 +161,7 @@ static inline QskGradientStops qskExtractedStops(
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 );
return extracted;
@ -370,7 +370,7 @@ bool QskGradient::hasStopAt( qreal value ) const
uint QskGradient::hash( uint seed ) const
{
if ( m_stops.isEmpty() )
if ( m_stops.isEmpty() )
return seed;
uint hash = qHashBits( &m_orientation, sizeof( m_orientation ), seed );

View File

@ -342,7 +342,7 @@ void QskObjectCounter::debugStatistics( QDebug debug, ObjectType objectType ) co
{
debug << "\tClass: " << object->metaObject()->className();
if ( !object->objectName().isEmpty() )
debug << " Name: " << object->objectName();
debug << " Name: " << object->objectName();
debug << '\n';
}
}

View File

@ -10,10 +10,10 @@
#define RGB( color, weight ) color ## weight
#define RGBTABLE( c ) \
{ \
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, 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 ) \
}
namespace
{
@ -77,7 +77,7 @@ static QskGradientStops qskColorStops(
for ( int i = 1; i < count; i++ )
{
const qreal pos = i * step;
stops += QskGradientStop( pos, rgb[i-1] );
stops += QskGradientStop( pos, rgb[i - 1] );
stops += QskGradientStop( pos, rgb[i] );
}
}

View File

@ -151,7 +151,7 @@ QSizeF QskGraphicLabelSkinlet::sizeHint( const QskSkinnable* skinnable,
constexpr qreal max = std::numeric_limits< int >::max();
QRectF r( 0.0, 0.0, max, max );
if ( constraint.width() >= 0.0 )
r.setWidth( constraint.width() );
else
@ -164,7 +164,7 @@ QSizeF QskGraphicLabelSkinlet::sizeHint( const QskSkinnable* skinnable,
if ( constraint.width() >= 0.0 )
hint.setHeight( innerConstraint.width() / aspectRatio );
else
else
hint.setWidth( innerConstraint.height() * aspectRatio );
}

View File

@ -437,7 +437,7 @@ QSGNode* QskListViewSkinlet::updateCellNode( const QskListView* listView,
QskAspect::States rowStates;
if ( row == listView->selectedRow() )
rowStates |= QskListView::Selected;
QskSkinStateChanger stateChanger( listView, rowStates );
QSGNode* newNode = nullptr;

View File

@ -17,15 +17,15 @@ QSK_SYSTEM_STATE( QskMenu, Selected, QskAspect::FirstSystemState << 2 )
class QskMenu::PrivateData
{
public:
QVector< Entry > entries;
QVector< QskGraphic > icons;
public:
QVector< Entry > entries;
QVector< QskGraphic > icons;
QskTextOptions textOptions;
QPointF origin;
QskTextOptions textOptions;
QPointF origin;
int currentIndex = 0;
bool isPressed = false;
int currentIndex = 0;
bool isPressed = false;
};
QskMenu::QskMenu( QQuickItem* parent )
@ -48,14 +48,14 @@ QskMenu::~QskMenu()
}
void QskMenu::setOrigin( const QPointF& origin )
{
{
if ( origin != m_data->origin )
{
m_data->origin = origin;
Q_EMIT originChanged( origin );
}
}
QPointF QskMenu::origin() const
{
return m_data->origin;
@ -275,7 +275,7 @@ void QskMenu::mouseReleaseEvent( QMouseEvent* event )
}
void QskMenu::aboutToShow()
{
{
setGeometry( QRectF( m_data->origin, sizeConstraint() ) );
Inherited::aboutToShow();
}
@ -293,7 +293,7 @@ void QskMenu::setSelectedIndex( int index )
if ( index >= 0 )
setCurrentIndex( index );
Q_EMIT triggered( index );
close();
}

View File

@ -19,12 +19,12 @@ class QSK_EXPORT QskMenu : public QskPopup
Q_OBJECT
Q_PROPERTY( QPointF origin READ origin
WRITE setOrigin NOTIFY originChanged )
WRITE setOrigin NOTIFY originChanged )
Q_PROPERTY( int count READ count )
Q_PROPERTY( int currentIndex READ currentIndex
WRITE setCurrentIndex NOTIFY currentIndexChanged )
WRITE setCurrentIndex NOTIFY currentIndexChanged )
using Inherited = QskPopup;

View File

@ -52,19 +52,19 @@ static QSizeF qskIconSize( const QskMenu* menu )
const auto hint = menu->strutSizeHint( QskMenu::Graphic );
const qreal textHeight = QFontMetrics(
menu->effectiveFont( QskMenu::Text ) ).height();
const auto h = qMax( hint.height(), textHeight );
qreal maxW = 0.0;
for ( int i = 0; i < menu->count(); i++ )
{
const auto w = menu->graphicAt( i ).widthForHeight( h );
if( w > maxW )
if( w > maxW )
maxW = w;
}
}
const auto w = qMax( hint.width(), maxW );
return QSizeF( w, h );
}
@ -98,7 +98,7 @@ static QSGNode* qskUpdateTextNode( const QskMenu* menu,
QskMenu::Text, Qt::AlignVCenter | Qt::AlignLeft );
return QskSkinlet::updateTextNode( menu, node, rect, alignment,
text, menu->textOptions(), QskMenu::Text );
text, menu->textOptions(), QskMenu::Text );
}
static QSGNode* qskUpdateBackgroundNode( const QskMenu*, QSGNode* )
@ -213,7 +213,7 @@ static QSGNode* qskUpdateItemsNode( const QskMenu* menu, QSGNode* rootNode )
auto textRect = cellRect;
textRect.setX( graphicRect.right() + spacing );
qskUpdateItemNode( menu, graphicRect, menu->graphicAt( i ),
textRect, menu->entryAt( i ).text, node );
}
@ -284,7 +284,7 @@ QSGNode* QskMenuSkinlet::updateContentsNode(
{
newNode = qskUpdateItemsNode( menu, oldNode );
break;
}
}
}
QskSGNode::replaceChildNode( roles, role, contentsNode, oldNode, newNode );

View File

@ -20,8 +20,8 @@ class QSK_EXPORT QskMenuSkinlet : public QskPopupSkinlet
Q_INVOKABLE QskMenuSkinlet( QskSkin* = nullptr );
~QskMenuSkinlet() = default;
QRectF subControlRect( const QskSkinnable*, const QRectF&,
QskAspect::Subcontrol ) const override;
QRectF subControlRect( const QskSkinnable*,
const QRectF&, QskAspect::Subcontrol ) const override;
QSizeF sizeHint( const QskSkinnable*,
Qt::SizeHint, const QSizeF& ) const override;

View File

@ -144,7 +144,7 @@ QskPopup::QskPopup( QQuickItem* parent )
Unfortunatly derived classes can't use setAcceptedMouseButtons anymore.
Need to think about a solution TODO ...
*/
Inherited::setAcceptedMouseButtons( Qt::AllButtons );
Inherited::setWheelEnabled( true );

View File

@ -39,7 +39,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
Q_PROPERTY( bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL )
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
WRITE setShape RESET resetShape NOTIFY shapeChanged )
WRITE setShape RESET resetShape NOTIFY shapeChanged )
using Inherited = QskAbstractButton;

View File

@ -32,7 +32,7 @@ inline const QVariant* qskResolvedHint( QskAspect aspect,
We intend to remove the obscure mechanism of resolving a hint
by dropping the state bits ony by one in the future. Instead we
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() )
{

View File

@ -19,7 +19,7 @@ namespace
{
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 );
}
@ -46,19 +46,19 @@ namespace
inline bool removeHintStateMask(
QskSkinHintTable* table, QskAspect aspect,
bool noState, QskAspect::States states, QskAspect::States mask )
{
{
if ( mask == 0 )
{
{
if ( noState || states != 0 )
return table->removeHint( aspect | states );
return false;
}
const auto stateLow = lowestState( mask );
mask &= ~stateLow;
bool ret = removeHintStateMask( table, aspect, noState, states, mask );
ret |= removeHintStateMask( table, aspect, noState, states | stateLow, mask );

View File

@ -26,7 +26,7 @@
#include <qquickwindow.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
@ -568,7 +568,7 @@ QSizeF QskSkinlet::hintWithoutConstraint(
{
/*
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;

View File

@ -122,7 +122,7 @@ class QSK_EXPORT QskSkinlet
void replaceChildNode( quint8 nodeRole, QSGNode* parentNode,
QSGNode* oldNode, QSGNode* newNode ) const;
QSizeF hintWithoutConstraint(
QSizeF hintWithoutConstraint(
const QSizeF& hint, const QSizeF& constraint ) const;
private:

View File

@ -44,7 +44,7 @@ class QSK_EXPORT QskStatusIndicator : public QskControl
int status() const;
bool hasStatus( int status ) const;
QList<int> statusList() const;
QList< int > statusList() const;
public Q_SLOTS:
void setStatus( int status );

View File

@ -67,7 +67,7 @@ namespace
for ( int i = 0; i < buttons.count(); i++ )
addItem( buttons[ i ] );
}
}
}
};
}

View File

@ -15,7 +15,7 @@ QskArcNode::~QskArcNode()
}
void QskArcNode::setArcData( const QRectF& rect, const QskArcMetrics& metrics,
const QskGradient &gradient, QQuickWindow* window )
const QskGradient& gradient, QQuickWindow* window )
{
m_metrics = metrics;
m_gradient = gradient;
@ -23,7 +23,7 @@ void QskArcNode::setArcData( const QRectF& rect, const QskArcMetrics& metrics,
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 QRectF rect( 0.5 * w, 0.5 * w, size.width() - w, size.height() - w );