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
};
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

@ -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

@ -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

@ -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

@ -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

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

View File

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

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

@ -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

@ -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

@ -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

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

View File

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

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() ];

View File

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

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

@ -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;

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

@ -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

@ -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