Merge branch 'master' into cmake

This commit is contained in:
Uwe Rathmann 2023-04-04 09:33:27 +02:00
commit d7007b4c22
57 changed files with 162 additions and 197 deletions

View File

@ -18,7 +18,7 @@ namespace
{
public:
ButtonBox( Qt::Orientation orientation, QQuickItem* parent = nullptr )
: ButtonBox( orientation, -1, parent )
: ButtonBox( orientation, std::numeric_limits< uint >::max(), parent )
{
}

View File

@ -30,7 +30,7 @@ namespace
TypeCount
};
Q_ENUM( ButtonType );
Q_ENUM( ButtonType )
Button( ButtonType type, QQuickItem* parent = nullptr )
: QskPushButton( parent )

View File

@ -28,7 +28,7 @@ class CircularProgressBar : public QskBoundedControl
CircularProgressBar( qreal min, qreal max, QQuickItem* parent = nullptr );
CircularProgressBar( QQuickItem* parent = nullptr );
~CircularProgressBar();
~CircularProgressBar() override;
bool isIndeterminate() const;
void setIndeterminate( bool on = true );

View File

@ -118,7 +118,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
QskAspect::Subcontrol areaSubcontrol = subcontrolForIndex( Diagram::Area, i );
QskAspect::Subcontrol barSubcontrol = subcontrolForIndex( Diagram::Bar, i );
int lineWidth = diagram->metric( lineSubcontrol | QskAspect::Size );
const auto lineWidth = diagram->metric( lineSubcontrol | QskAspect::Size );
for( const auto type : { Diagram::Line, Diagram::Area, Diagram::Bar } )
{

View File

@ -31,8 +31,7 @@ LightDisplaySkinlet::~LightDisplaySkinlet()
QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
{
auto* display = static_cast< const LightDisplay* >( skinnable );
QRectF rect = contentsRect;
auto display = static_cast< const LightDisplay* >( skinnable );
const qreal ticksSpacing = 4; // space between the ticks and the arc
if( subControl == LightDisplay::Groove || subControl == LightDisplay::Panel )
@ -50,25 +49,23 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
const qreal diameter = qMin( w, h );
rect = QRectF( x, y, diameter, diameter );
return rect;
return QRectF( x, y, diameter, diameter );
}
else if( subControl == LightDisplay::ColdAndWarmArc )
{
const QRectF panelRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel );
auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width();
auto rect = panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } );
return rect;
const auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width();
return panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } );
}
else if( subControl == LightDisplay::Tickmarks )
{
const QRectF arcRect = subControlRect(
const auto arcRect = subControlRect(
skinnable, contentsRect, LightDisplay::ColdAndWarmArc );
const qreal ticksWidth = display->arcMetricsHint(
LightDisplay::Tickmarks ).width() + ticksSpacing;
const QRectF rect =
arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } );
return rect;
return arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } );
}
else if( subControl == LightDisplay::ValueText )
{
@ -76,14 +73,18 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
const QFontMetricsF fm( skinnable->effectiveFont( subControl ) );
const qreal fontWidth = qskHorizontalAdvance( fm, QStringLiteral( "100 %" ) );
const QPointF center = valueTextRect.center();
const QRectF rect( center.x() - fontWidth / 2, center.y() - fm.height() / 2, fontWidth, fm.height() );
return rect;
return QRectF(
center.x() - fontWidth / 2, center.y() - fm.height() / 2,
fontWidth, fm.height() );
}
else if( subControl == LightDisplay::LeftLabel )
{
const QRectF ticksRect = subControlRect( skinnable, contentsRect, LightDisplay::Tickmarks );
const QRectF ticksRect = subControlRect(
skinnable, contentsRect, LightDisplay::Tickmarks );
const auto size = textLabelsSize( display );
auto rect = contentsRect;
rect.setWidth( size.width() );
rect.setY( ticksRect.y() + ( ticksRect.height() - size.height() ) / 2 );
@ -96,6 +97,7 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
const auto ticksRect = subControlRect( skinnable, contentsRect, LightDisplay::Tickmarks );
const auto size = textLabelsSize( display );
auto rect = contentsRect;
rect.setX( ticksRect.x() + ticksRect.width() );
rect.setY( ticksRect.y() + ( ticksRect.height() - size.height() ) / 2 );
@ -119,8 +121,7 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
const auto x = arcRect.center().x() - knobSize.width() / 2 - radius * cos;
const auto y = arcRect.center().y() - knobSize.height() / 2 - radius * sin;
rect = QRectF( x, y, knobSize.width(), knobSize.height() );
return rect;
return QRectF( x, y, knobSize.width(), knobSize.height() );
}
return contentsRect;

View File

@ -19,7 +19,7 @@ DiagramSegmentsNode::DiagramSegmentsNode()
void DiagramSegmentsNode::update( const QRectF& rect, const QColor& color,
const QVector< QVector< QPointF > >& dataPoints, int xGridLines )
{
Q_UNUSED( rect );
Q_UNUSED( rect )
if( color != m_color )
{

View File

@ -72,7 +72,6 @@ class TabView : public QskTabView
{
for ( int i = 0; i < 10; i++ )
{
QString text;
if ( i == 4 )
{
const auto text = QStringLiteral( "Another Tab" );

View File

@ -158,7 +158,7 @@ class IconGrid : public QskLinearBox
private:
void setItemsVisible( const QRectF& rect, bool on )
{
const int dim = dimension();
const auto dim = dimension();
// we know, that all items have the same size
const auto itemSize = itemAtIndex( 0 )->size();

View File

@ -24,7 +24,7 @@ class QskPlatformInputContext final : public QPlatformInputContext
public:
QskPlatformInputContext();
virtual ~QskPlatformInputContext() = default;
~QskPlatformInputContext() override = default;
bool isValid() const override;
bool hasCapability( Capability ) const override;

View File

@ -132,10 +132,10 @@ void LayoutSolver::setup( bool layoutChildren,
const auto expr1 = r1.expressionAt( anchor.edge1 );
Expression expr2;
if ( anchor.item2 == nullptr )
{
Expression expr2;
switch( anchor.edge2 )
{
case Qt::AnchorLeft:

View File

@ -10,35 +10,12 @@
#include <QThread>
#include <QTimer>
void debugNone1()
{
qDebug() << "None 1";
}
void debugNone2()
{
qDebug() << "None 2";
}
void debugValueI1( int i )
{
qDebug() << "I1" << i;
}
void debugValueI2( int i )
{
qDebug() << "I2" << i;
}
void debugValueD( qreal d )
{
qDebug() << "D" << d;
}
void debugValue( qreal d, int i )
{
qDebug() << d << i;
}
static void debugNone1() { qDebug() << "None 1"; }
static void debugNone2() { qDebug() << "None 2"; }
static void debugValueI1( int i ) { qDebug() << "I1" << i; }
static void debugValueI2( int i ) { qDebug() << "I2" << i; }
static void debugValueD( qreal d ) { qDebug() << "D" << d; }
static void debugValue( qreal d, int i ) { qDebug() << d << i; }
class MyObject : public QObject
{
@ -166,7 +143,7 @@ class Application : public QCoreApplication
#endif
}
virtual ~Application()
~Application() override
{
delete m_object;
}

View File

@ -29,7 +29,7 @@ class GeometricShape : public ShapeItem
Hexagon,
Arc
};
Q_ENUM( Figure );
Q_ENUM( Figure )
GeometricShape( QQuickItem* parent = nullptr );
GeometricShape( Figure figure, QQuickItem* parent = nullptr );

View File

@ -8,7 +8,7 @@
Stroke::Stroke( const QPen& pen ) noexcept
: m_width( pen.widthF() )
, m_miterLimit( pen.miterLimit() )
, m_miterLimit( qRound( pen.miterLimit() ) )
, m_color( pen.color() )
, m_lineStyle( ( pen.style() == Qt::DashLine ) ? DashLine : SolidLine )
, m_joinStyle( static_cast< JoinStyle >( pen.joinStyle() ) )

View File

@ -202,7 +202,7 @@ namespace QskQml
return qmlregister( TypeRegistration, &type );
}
int registerUncreatableMetaObject(
inline int registerUncreatableMetaObject(
const QMetaObject& staticMetaObject, const char* qmlName )
{
using namespace QQmlPrivate;

View File

@ -58,12 +58,12 @@ static const int qskDuration = 150;
namespace
{
inline double operator ""_dp( long double value )
Q_DECL_UNUSED inline double operator ""_dp( long double value )
{
return qskDpToPixels( static_cast< qreal >( value ) );
}
inline double operator ""_dp( unsigned long long value )
Q_DECL_UNUSED inline double operator ""_dp( unsigned long long value )
{
return qskDpToPixels( value );
}
@ -115,25 +115,17 @@ namespace
return QskGraphicIO::read( path );
}
void setStandardSymbol( QskAspect aspect,
QskStandardSymbol::Type symbolType )
{
setSymbol( aspect, QskStandardSymbol::graphic( symbolType ) );
}
const QskMaterial3Theme& m_pal;
};
QFont createFont( const QString& name, int lineHeight,
int size, qreal tracking, QFont::Weight weight )
QFont createFont( const QString& name, qreal lineHeight,
qreal size, qreal tracking, QFont::Weight weight )
{
QFont font( name, size );
font.setPixelSize( lineHeight );
QFont font( name, qRound( size ) );
font.setPixelSize( qRound( lineHeight ) );
if( !qskFuzzyCompare( tracking, 0.0 ) )
{
font.setLetterSpacing( QFont::AbsoluteSpacing, tracking );
}
font.setWeight( weight );
@ -498,8 +490,8 @@ void Editor::setupSegmentedBar()
using A = QskAspect;
using Q = QskSegmentedBar;
const QSize panelStrutSize( -1, 48_dp );
const QSize segmentStrutSize( 48_dp, 40_dp );
const QSizeF panelStrutSize( -1, 48_dp );
const QSizeF segmentStrutSize( 48_dp, 40_dp );
{
// Container

View File

@ -53,12 +53,12 @@ static const int qskDuration = 200;
namespace
{
inline double operator ""_dp( long double value )
Q_DECL_UNUSED inline double operator ""_dp( long double value )
{
return qskDpToPixels( static_cast< qreal >( value ) );
}
inline double operator ""_dp( unsigned long long value )
Q_DECL_UNUSED inline double operator ""_dp( unsigned long long value )
{
return qskDpToPixels( value );
}
@ -571,7 +571,7 @@ void Editor::setupSegmentedBar()
setBoxBorderColors( Q::Panel, borderColors );
const QSize strutSize( 100_dp, 50_dp );
const QSizeF strutSize( 100_dp, 50_dp );
setStrutSize( Q::Panel | A::Horizontal, strutSize );
setStrutSize( Q::Panel | A::Vertical, strutSize.transposed() );

View File

@ -59,7 +59,7 @@ class QSK_EXPORT QskBoxShapeMetrics
Proportional
};
Q_ENUM( ScalingMode );
Q_ENUM( ScalingMode )
constexpr QskBoxShapeMetrics() noexcept;

View File

@ -327,7 +327,7 @@ int QskGradient::stepCount() const noexcept
if ( !isValid() )
return 0;
int steps = m_stops.count() - 1;
auto steps = static_cast< int >( m_stops.count() ) - 1;
if ( m_stops.first().position() > 0.0 )
steps++;

View File

@ -102,8 +102,10 @@ QDebug operator<<( QDebug debug, const QskGradientStop& stop )
static inline QColor qskInterpolatedColor(
const QskGradientStops& stops, int index1, int index2, qreal position )
{
index1 = qBound( 0, index1, stops.count() - 1 );
index2 = qBound( 0, index2, stops.count() - 1 );
const auto max = static_cast< int >( stops.count() ) - 1;
index1 = qBound( 0, index1, max );
index2 = qBound( 0, index2, max );
return QskGradientStop::interpolated( stops[ index1 ], stops[ index2 ], position );
}
@ -138,7 +140,7 @@ QskGradientStops qskTransparentGradientStops( const QskGradientStops& stops, qre
for ( auto& stop : newStops )
{
auto c = stop.color();
c.setAlpha( c.alpha() * ratio );
c.setAlpha( qRound( c.alpha() * ratio ) );
stop.setColor( c );
}

View File

@ -544,7 +544,7 @@ static XYZ nthVertex( double y, int n )
return { -1.0, -1.0, -1.0 };
}
void bisectToSegment( double y, double targetHue, XYZ& left, XYZ& right )
static void bisectToSegment( double y, double targetHue, XYZ& left, XYZ& right )
{
left = { -1.0, -1.0, -1.0 };
right = left;

View File

@ -154,7 +154,7 @@ int QskMetaFunction::returnType() const
size_t QskMetaFunction::parameterCount() const
{
int count = 0;
size_t count = 0;
if ( auto types = parameterTypes() )
{

View File

@ -35,9 +35,9 @@ class QskMetaFunction::FunctionCall : public QtPrivate::QSlotObjectBase
protected:
explicit inline FunctionCall( InvokeFunction f,
const int* m_parameterTypes = nullptr ):
const int* parameterTypes = nullptr ):
QSlotObjectBase( f ),
m_parameterTypes( m_parameterTypes )
m_parameterTypes( parameterTypes )
{
}

View File

@ -152,7 +152,7 @@ QMetaMethod qskNotifySignal( const QMetaObject* metaObject, const char* property
static void qskInvokeMetaCall(
QObject* object, const QMetaObject* metaObject,
QMetaObject::Call call, int offset, int index, void* argv[],
QMetaObject::Call call, ushort offset, ushort index, void* argv[],
Qt::ConnectionType connectionType )
{
QPointer< QObject > receiver( object );
@ -196,6 +196,7 @@ static void qskInvokeMetaCall(
QSemaphore semaphore;
Q_ASSERT( metaObject == nullptr || receiver->metaObject() == metaObject );
qskInvokeMetaCallQueued( receiver, call,
offset, index, argv, &semaphore );
@ -256,6 +257,7 @@ static void qskInvokeMetaCall(
return;
}
Q_ASSERT( metaObject == nullptr || receiver->metaObject() == metaObject );
qskInvokeMetaCallQueued( object, call, offset, index, arguments, nullptr );
break;

View File

@ -132,8 +132,8 @@ QSK_EXPORT void qskInvokeMetaPropertyWrite(
void* args[], Qt::ConnectionType = Qt::AutoConnection );
QSK_EXPORT void qskInvokeMetaPropertyWrite(
const QObject* object, const QMetaProperty&,
void* args[], Qt::ConnectionType = Qt::AutoConnection );
QObject*, const QMetaProperty&, void* args[],
Qt::ConnectionType = Qt::AutoConnection );
QSK_EXPORT QMetaMethod qskNotifySignal( const QMetaObject*, const char* propertyName );
QSK_EXPORT QMetaMethod qskNotifySignal( const QObject*, const char* propertyName );

View File

@ -27,15 +27,17 @@ QskScaleTickmarks::~QskScaleTickmarks()
int QskScaleTickmarks::tickCount() const noexcept
{
return m_ticks[ MajorTick ].count()
const auto count = m_ticks[ MajorTick ].count()
+ m_ticks[ MediumTick ].count()
+ m_ticks[ MinorTick ].count();
return static_cast< int >( count );
}
int QskScaleTickmarks::tickCount( TickType type ) const noexcept
{
return m_ticks[ type ].count();
return static_cast< int >( m_ticks[ type ].count() );
}
QVector< qreal > QskScaleTickmarks::ticks( TickType type ) const noexcept

View File

@ -25,7 +25,7 @@ class QSK_EXPORT QskMenuSkinlet : public QskPopupSkinlet
};
Q_INVOKABLE QskMenuSkinlet( QskSkin* = nullptr );
~QskMenuSkinlet();
~QskMenuSkinlet() override;
QRectF subControlRect( const QskSkinnable*,
const QRectF&, QskAspect::Subcontrol ) const override;

View File

@ -382,9 +382,11 @@ bool QskPopup::hasFaderEffect() const
void QskPopup::setPopupFlags( PopupFlags flags )
{
if ( static_cast< int >( flags ) != m_data->flags )
const auto newFlags = static_cast< int >( flags );
if ( newFlags != m_data->flags )
{
m_data->flags = flags;
m_data->flags = newFlags;
updateInputGrabber();
}
}

View File

@ -16,7 +16,7 @@ namespace
class RootNode : public QSGNode
{
public:
~RootNode()
~RootNode() override
{
delete m_clipNode;
delete m_transformNode;

View File

@ -85,7 +85,6 @@ QRectF QskProgressBarSkinlet::subControlRect(
if( subControl == QskProgressBar::Bar )
{
const auto bar = static_cast< const QskProgressBar* >( skinnable );
return barRect( bar );
}

View File

@ -177,16 +177,13 @@ void QskRadioBox::keyPressEvent( QKeyEvent* event )
}
else
{
setFocusedIndex( ( float ) nextTabIndex );
setFocusedIndex( nextTabIndex );
const auto aspect = Ripple | QskAspect::Metric | QskAspect::Position;
const auto hint = animationHint( aspect | skinStates() );
if( hint.isValid() )
{
startTransition( aspect, hint,
( float ) currentTabIndex, ( float ) nextTabIndex );
}
startTransition( aspect, hint, currentTabIndex, nextTabIndex );
}
update();

View File

@ -9,6 +9,7 @@
#include "QskFunctions.h"
#include <qfontmetrics.h>
#include <qmath.h>
namespace
{
@ -83,7 +84,7 @@ QSGNode* QskRadioBoxSkinlet::updateSubNode( const QskSkinnable* skinnable,
case RippleRole:
return updateBoxNode( skinnable, node, Q::Ripple );
};
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
@ -100,7 +101,7 @@ QRectF QskRadioBoxSkinlet::rippleRect(
{
using Q = QskRadioBox;
const auto index = radioBox->positionHint( Q::Ripple );
const auto index = qFloor( radioBox->positionHint( Q::Ripple ) );
if( index < 0 )
return QRectF();

View File

@ -201,7 +201,7 @@ namespace
public:
ClipItem( QskScrollArea* );
virtual ~ClipItem();
~ClipItem() override;
void enableGeometryListener( bool on );

View File

@ -251,7 +251,7 @@ void QskSkin::setupFonts( const QString& family, int weight, bool italic )
for ( int i = TinyFont; i <= HugeFont; i++ )
{
font.setPixelSize( qskDpToPixels( sizes[i - 1] ) );
font.setPixelSize( qRound( qskDpToPixels( sizes[i - 1] ) ) );
m_data->fonts[ i ] = font;
}

View File

@ -203,23 +203,6 @@ namespace
return m_skinMap.keys();
}
QStringList skinNames( const QString& factoryId ) const
{
const auto it = m_factoryMap.constFind( factoryId );
if ( it != m_factoryMap.constEnd() )
{
const auto& data = it.value();
if ( data.factory )
return data.factory->skinNames();
if ( data.loader )
return data.loader->skinNames();
}
return QStringList();
}
void insertFactory( FactoryLoader* loader )
{
auto& data = m_factoryMap[ loader->factoryId() ];
@ -251,11 +234,11 @@ namespace
void removeFactory( const QString& factoryId )
{
const auto it = m_factoryMap.find( factoryId );
if ( it == m_factoryMap.end() )
const auto itFactory = m_factoryMap.find( factoryId );
if ( itFactory == m_factoryMap.end() )
return;
m_factoryMap.erase( it );
m_factoryMap.erase( itFactory );
if ( m_isValid )
{

View File

@ -160,7 +160,7 @@ namespace
Q_OBJECT
public:
~ApplicationAnimator();
~ApplicationAnimator() override;
WindowAnimator* windowAnimator( const QQuickWindow* );

View File

@ -753,10 +753,12 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter(
aspect.setSection( QskAspect::Body );
aspect.setVariation( QskAspect::NoVariation );
const auto v = animatedHint( aspect, nullptr );
{
const auto v = animatedHint( aspect, nullptr );
if ( v.canConvert< QskColorFilter >() )
return v.value< QskColorFilter >();
if ( v.canConvert< QskColorFilter >() )
return v.value< QskColorFilter >();
}
if ( auto control = owningControl() )
{
@ -816,16 +818,18 @@ QskAnimationHint QskSkinnable::effectiveAnimation(
QskAnimationHint hint;
const auto a = m_data->hintTable.resolvedAnimator( aspect, hint );
if ( a.isAnimator() )
{
if ( status )
const auto a = m_data->hintTable.resolvedAnimator( aspect, hint );
if ( a.isAnimator() )
{
status->source = QskSkinHintStatus::Skinnable;
status->aspect = a;
}
if ( status )
{
status->source = QskSkinHintStatus::Skinnable;
status->aspect = a;
}
return hint;
return hint;
}
}
if ( auto skin = effectiveSkin() )
@ -1390,9 +1394,9 @@ bool QskSkinnable::startHintTransitions(
that differ between the states
*/
for ( uint i = 0; i < primitiveCount; i++ )
for ( uint j = 0; j < primitiveCount; j++ )
{
const auto primitive = static_cast< QskAspect::Primitive >( i );
const auto primitive = static_cast< QskAspect::Primitive >( j );
aspect.setPrimitive( type, primitive );
const auto a1 = aspect | oldStates;

View File

@ -184,7 +184,7 @@ namespace
auto boxSize = viewContentsRect().size();
boxSize = qskConstrainedItemSize( box, boxSize );
if ( auto box = buttonBox() )
if ( box )
box->setSize( boxSize );
enableAutoTranslation( false );

View File

@ -138,7 +138,7 @@ static inline void qskReadStateData(
quint16 flags;
s >> flags;
data.flags = ( QPaintEngine::DirtyFlags ) flags;
data.flags = static_cast< QPaintEngine::DirtyFlags >( flags );
if ( data.flags & QPaintEngine::DirtyPen )
s >> data.pen;
@ -316,7 +316,7 @@ bool QskGraphicIO::write( const QskGraphic& graphic, QIODevice* dev )
stream.setByteOrder( QDataStream::BigEndian );
stream.writeRawData( qskMagicNumber, 4 );
const int numCommands = graphic.commands().size();
const auto numCommands = graphic.commands().size();
const QskPainterCommand* cmds = graphic.commands().constData();
stream << static_cast< quint32 >( numCommands );

View File

@ -32,7 +32,7 @@ static inline QSize qskGraphicSize( const QskGraphic& graphic,
if ( requestedSize.width() < 0 )
{
const auto f = requestedSize.height() / defaultSize.height();
return QSize( f * defaultSize.width(),
return QSize( static_cast< int >( f * defaultSize.width() ),
static_cast< int >( requestedSize.height() ) );
}

View File

@ -554,7 +554,7 @@ QskTextPredictor* QskInputContextFactory::createPredictor( const QLocale& locale
#if HUNSPELL
return new QskHunspellTextPredictor( locale );
#else
Q_UNUSED( locale );
Q_UNUSED( locale )
#endif
return nullptr;

View File

@ -48,7 +48,7 @@ class QSK_EXPORT QskInputContext : public QObject
public:
QskInputContext();
virtual ~QskInputContext();
~QskInputContext() override;
void setFactory( QskInputContextFactory* );
QskInputContextFactory* factory() const;

View File

@ -148,16 +148,14 @@ namespace
// Let the input field update right away, otherwise
// we'll get weird effects with fast backspace presses:
Q_EMIT keyProcessingFinished( m_currentResult );
return;
}
else
{
m_currentResult.key = Qt::Key_Backspace;
Q_EMIT keyProcessingFinished( m_currentResult );
return;
}
break;
return;
}
case Qt::Key_Return:
{

View File

@ -518,10 +518,10 @@ void QskGridBox::dump() const
if ( auto item = engine.itemAt( i ) )
{
const auto constraint = qskSizeConstraint( item, Qt::PreferredSize );
const auto size = qskSizeConstraint( item, Qt::PreferredSize );
debug << item->metaObject()->className()
<< " w:" << constraint.width() << " h:" << constraint.height();
<< " w:" << size.width() << " h:" << size.height();
}
else
{

View File

@ -485,11 +485,11 @@ int QskGridLayoutEngine::insertSpacer( const QSizeF& spacing, const QRect& grid
bool QskGridLayoutEngine::removeAt( int index )
{
const auto element = m_data->elementAt( index );
if ( element == nullptr )
const auto elementAt = m_data->elementAt( index );
if ( elementAt == nullptr )
return false;
const auto grid = element->minimumGrid();
const auto grid = elementAt->minimumGrid();
auto& elements = m_data->elements;
elements.erase( elements.begin() + index );
@ -504,10 +504,10 @@ bool QskGridLayoutEngine::removeAt( int index )
for ( const auto& element : elements )
{
const auto grid = element.minimumGrid();
const auto minGrid = element.minimumGrid();
maxRow = qMax( maxRow, grid.bottom() );
maxColumn = qMax( maxColumn, grid.right() );
maxRow = qMax( maxRow, minGrid.bottom() );
maxColumn = qMax( maxColumn, minGrid.right() );
}
m_data->rowCount = maxRow + 1;

View File

@ -250,7 +250,7 @@ QskLayoutChain::Segments QskLayoutChain::segments( qreal size ) const
const qreal padding = size - m_boundingMetrics.maximum();
qreal offset = 0.0;
qreal extra = 0.0;;
qreal extra = 0.0;
switch( m_fillMode )
{
@ -424,13 +424,13 @@ QskLayoutChain::Segments QskLayoutChain::preferredStretched( qreal size ) const
if ( factors[i] < 0.0 )
continue;
const auto size = sumSizes * factors[i] / sumFactors;
const auto sz = sumSizes * factors[i] / sumFactors;
const auto& hint = m_cells[i].metrics;
const auto boundedSize =
qBound( hint.preferred(), size, hint.maximum() );
qBound( hint.preferred(), sz, hint.maximum() );
if ( boundedSize != size )
if ( boundedSize != sz )
{
segments[i].length = boundedSize;
sumSizes -= boundedSize;

View File

@ -556,9 +556,9 @@ void QskLinearBox::dump() const
if ( auto item = engine.itemAt( i ) )
{
const auto constraint = qskSizeConstraint( item, Qt::PreferredSize );
const auto size = qskSizeConstraint( item, Qt::PreferredSize );
debug << item->metaObject()->className()
<< " w:" << constraint.width() << " h:" << constraint.height();
<< " w:" << size.width() << " h:" << size.height();
}
else
{

View File

@ -450,9 +450,9 @@ void QskStackBox::dump() const
debug << " " << i << ": ";
const auto constraint = qskSizeConstraint( item, Qt::PreferredSize );
const auto size = qskSizeConstraint( item, Qt::PreferredSize );
debug << item->metaObject()->className()
<< " w:" << constraint.width() << " h:" << constraint.height();
<< " w:" << size.width() << " h:" << size.height();
if ( i == m_data->currentIndex )
debug << " [X]";

View File

@ -50,6 +50,4 @@ QskHashValue QskArcNode::hash( const void* nodeData ) const
auto h = arcData->metrics.hash();
return arcData->gradient.hash( h );
return h;
}

View File

@ -31,7 +31,7 @@ namespace
}
inline int edgeToIndex( Qt::Edge edge )
{ return qCountTrailingZeroBits( (quint8) edge ); }
{ return qCountTrailingZeroBits( static_cast< quint8 >( edge ) ); }
class CornerIterator : public QskVertex::ArcIterator
{

View File

@ -183,7 +183,7 @@ namespace
{
public:
Point() = default;
inline Point( qreal x, qreal y, qreal v ): x( x ), y( y ), v( v ) {};
inline Point( qreal x, qreal y, qreal v ): x( x ), y( y ), v( v ) {}
qreal x = 0;
qreal y = 0;
@ -625,10 +625,10 @@ namespace
{
const auto p = vec.pointAt( it.position() );
const qreal y1 = p.y() + ( p.x() - c1.x ) / m;
const qreal x2 = p.x() + ( p.y() - c1.y ) * m;
const qreal ly1 = p.y() + ( p.x() - c1.x ) / m;
const qreal lx2 = p.x() + ( p.y() - c1.y ) * m;
setLine( c1.x, y1, x2, c1.y, it.color(), l++ );
setLine( c1.x, ly1, lx2, c1.y, it.color(), l++ );
it.advance();
}
@ -642,10 +642,10 @@ namespace
{
const auto p = vec.pointAt( it.position() );
const qreal y1 = p.y() + ( p.x() - c2.x ) / m;
const qreal y2 = p.y() + ( p.x() - c3.x ) / m;
const qreal ly1 = p.y() + ( p.x() - c2.x ) / m;
const qreal ly2 = p.y() + ( p.x() - c3.x ) / m;
setLine( c2.x, y1, c3.x, y2, it.color(), l++ );
setLine( c2.x, ly1, c3.x, ly2, it.color(), l++ );
it.advance();
}
@ -661,10 +661,10 @@ namespace
{
const auto p = vec.pointAt( it.position() );
const qreal x1 = p.x() + ( p.y() - c2.y ) * m;
const qreal x2 = p.x() + ( p.y() - c3.y ) * m;
const qreal lx1 = p.x() + ( p.y() - c2.y ) * m;
const qreal lx2 = p.x() + ( p.y() - c3.y ) * m;
setLine( x1, c2.y, x2, c3.y, it.color(), l++ );
setLine( lx1, c2.y, lx2, c3.y, it.color(), l++ );
it.advance();
}
@ -675,10 +675,10 @@ namespace
{
const auto p = vec.pointAt( it.position() );
const qreal y1 = p.y() + ( p.x() - c4.x ) / m;
const qreal x2 = p.x() + ( p.y() - c4.y ) * m;
const qreal ly1 = p.y() + ( p.x() - c4.x ) / m;
const qreal lx2 = p.x() + ( p.y() - c4.y ) * m;
setLine( c4.x, y1, x2, c4.y, it.color(), l++ );
setLine( c4.x, ly1, lx2, c4.y, it.color(), l++ );
it.advance();
}

View File

@ -26,7 +26,7 @@ namespace
};
}
void qskUpdateChildren( QSGNode* parentNode, quint8 role, QSGNode* node )
static void qskUpdateChildren( QSGNode* parentNode, quint8 role, QSGNode* node )
{
static const QVector< quint8 > roles = { ShadowRole, BoxRole, FillRole };

View File

@ -35,7 +35,7 @@ namespace
setVerticalWrapMode( wrapMode );
setFiltering( QSGTexture::Linear );
};
}
private:
static inline QSGTexture::WrapMode wrapMode( QskGradient::SpreadMode spreadMode )

View File

@ -526,18 +526,18 @@ namespace
// Angles as ratio of a rotation
float start = fmod( dir.startAngle(), 360.0 ) / 360.0;
if ( start < 0.0)
start += 1.0;
if ( start < 0.0f)
start += 1.0f;
float span;
if ( dir.spanAngle() >= 360.0 )
{
span = 1.0;
span = 1.0f;
}
else if ( dir.spanAngle() <= -360.0 )
{
span = -1.0;
span = -1.0f;
}
else
{

View File

@ -83,15 +83,15 @@ namespace
inline void setAlignment( Qt::Alignment alignment )
{
setHAlign( ( QQuickText::HAlignment )( int( alignment ) & 0x0f ) );
setVAlign( ( QQuickText::VAlignment )( int( alignment ) & 0xf0 ) );
setHAlign( static_cast< QQuickText::HAlignment >( int( alignment ) & 0x0f ) );
setVAlign( static_cast< QQuickText::VAlignment >( int( alignment ) & 0xf0 ) );
}
inline void setOptions( const QskTextOptions& options )
{
// what about Qt::TextShowMnemonic ???
setTextFormat( ( QQuickText::TextFormat ) options.format() );
setElideMode( ( QQuickText::TextElideMode ) options.elideMode() );
setTextFormat( static_cast< QQuickText::TextFormat >( options.format() ) );
setElideMode( static_cast< QQuickText::TextElideMode >( options.elideMode() ) );
setMaximumLineCount( options.maximumLineCount() );
setWrapMode( static_cast< QQuickText::WrapMode >( options.wrapMode() ) );
}

View File

@ -174,8 +174,12 @@ QSGNode* QskScaleRenderer::updateTicksNode(
if( ticksNode == nullptr )
ticksNode = new QskTickmarksNode;
#if 1
const int tickWidth = qRound( m_data->tickWidth );
#endif
ticksNode->update( m_data->tickColor, rect, m_data->boundaries,
m_data->tickmarks, m_data->tickWidth, m_data->orientation,
m_data->tickmarks, tickWidth, m_data->orientation,
m_data->alignment );
return ticksNode;

View File

@ -28,7 +28,7 @@ class QSK_EXPORT QskScaleRenderer
{
public:
QskScaleRenderer();
~QskScaleRenderer();
virtual ~QskScaleRenderer();
void setOrientation( Qt::Orientation );
void setAlignment( Qt::Alignment );

View File

@ -73,7 +73,7 @@ namespace QskVertex
{
}
inline Color Color::interpolatedTo( Color colorTo, double ratio ) const noexcept
inline Color Color::interpolatedTo( Color colorTo, qreal ratio ) const noexcept
{
if ( ratio <= 0.0 )
return *this;
@ -81,11 +81,15 @@ namespace QskVertex
if ( ratio >= 1.0 )
return colorTo;
const double t = ratio;
const double rt = 1.0 - ratio;
const auto t = ratio;
const auto rt = 1.0 - ratio;
return Color( rt * r + t * colorTo.r, rt * g + t * colorTo.g,
rt * b + t * colorTo.b, rt * a + t * colorTo.a );
return Color(
static_cast< unsigned char >( rt * r + t * colorTo.r ),
static_cast< unsigned char >( rt * g + t * colorTo.g ),
static_cast< unsigned char >( rt * b + t * colorTo.b ),
static_cast< unsigned char >( rt * a + t * colorTo.a )
);
}
inline constexpr bool Color::operator==( const Color& other ) const noexcept