compiler warnings fixed

This commit is contained in:
Uwe Rathmann 2023-04-04 08:49:11 +02:00
parent b7cfb0b936
commit 7e36893d1c
40 changed files with 62 additions and 115 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -115,12 +115,6 @@ namespace
return QskGraphicIO::read( path ); return QskGraphicIO::read( path );
} }
void setStandardSymbol( QskAspect aspect,
QskStandardSymbol::Type symbolType )
{
setSymbol( aspect, QskStandardSymbol::graphic( symbolType ) );
}
const QskMaterial3Theme& m_pal; const QskMaterial3Theme& m_pal;
}; };
@ -131,9 +125,7 @@ namespace
font.setPixelSize( lineHeight ); font.setPixelSize( lineHeight );
if( !qskFuzzyCompare( tracking, 0.0 ) ) if( !qskFuzzyCompare( tracking, 0.0 ) )
{
font.setLetterSpacing( QFont::AbsoluteSpacing, tracking ); font.setLetterSpacing( QFont::AbsoluteSpacing, tracking );
}
font.setWeight( weight ); font.setWeight( weight );

View File

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

View File

@ -544,7 +544,7 @@ static XYZ nthVertex( double y, int n )
return { -1.0, -1.0, -1.0 }; 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 }; left = { -1.0, -1.0, -1.0 };
right = left; right = left;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -83,7 +83,7 @@ QSGNode* QskRadioBoxSkinlet::updateSubNode( const QskSkinnable* skinnable,
case RippleRole: case RippleRole:
return updateBoxNode( skinnable, node, Q::Ripple ); return updateBoxNode( skinnable, node, Q::Ripple );
}; }
return Inherited::updateSubNode( skinnable, nodeRole, node ); return Inherited::updateSubNode( skinnable, nodeRole, node );
} }

View File

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

View File

@ -203,23 +203,6 @@ namespace
return m_skinMap.keys(); 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 ) void insertFactory( FactoryLoader* loader )
{ {
auto& data = m_factoryMap[ loader->factoryId() ]; auto& data = m_factoryMap[ loader->factoryId() ];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -183,7 +183,7 @@ namespace
{ {
public: public:
Point() = default; 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 x = 0;
qreal y = 0; qreal y = 0;

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 }; static const QVector< quint8 > roles = { ShadowRole, BoxRole, FillRole };

View File

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

View File

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

View File

@ -28,7 +28,7 @@ class QSK_EXPORT QskScaleRenderer
{ {
public: public:
QskScaleRenderer(); QskScaleRenderer();
~QskScaleRenderer(); virtual ~QskScaleRenderer();
void setOrientation( Qt::Orientation ); void setOrientation( Qt::Orientation );
void setAlignment( Qt::Alignment ); 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 ) if ( ratio <= 0.0 )
return *this; return *this;
@ -81,11 +81,15 @@ namespace QskVertex
if ( ratio >= 1.0 ) if ( ratio >= 1.0 )
return colorTo; return colorTo;
const double t = ratio; const auto t = ratio;
const double rt = 1.0 - ratio; const auto rt = 1.0 - ratio;
return Color( rt * r + t * colorTo.r, rt * g + t * colorTo.g, return Color(
rt * b + t * colorTo.b, rt * a + t * colorTo.a ); 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 inline constexpr bool Color::operator==( const Color& other ) const noexcept