satisfying pedantic compiler flags

This commit is contained in:
Uwe Rathmann 2025-01-03 10:08:10 +01:00
parent eb31ef6738
commit 448ab6fff7
16 changed files with 26 additions and 25 deletions

View File

@ -54,7 +54,7 @@ macro(qsk_enable_pedantic_flags)
add_compile_options( -Wnon-virtual-dtor ) add_compile_options( -Wnon-virtual-dtor )
add_compile_options( -Woverloaded-virtual ) add_compile_options( -Woverloaded-virtual )
add_compile_options( -Wfloat-equal ) # add_compile_options( -Wfloat-equal )
if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )

View File

@ -88,7 +88,7 @@ namespace
} }
protected: protected:
void changeEvent( QEvent* event ) void changeEvent( QEvent* event ) override
{ {
if ( event->type() == QEvent::StyleChange ) if ( event->type() == QEvent::StyleChange )
updateText(); updateText();

View File

@ -31,7 +31,7 @@ class QskPlotCurveData : public QObject
*/ */
BoundingRectangle = 1 << 2 BoundingRectangle = 1 << 2
}; };
Q_ENUM( Hint ); Q_ENUM( Hint )
Q_DECLARE_FLAGS( Hints, Hint ) Q_DECLARE_FLAGS( Hints, Hint )

View File

@ -42,7 +42,7 @@ class QskPlotItem : public QObject, public QskSkinnable
PlotCoordinates PlotCoordinates
}; };
Q_ENUM( CoordinateType ); Q_ENUM( CoordinateType )
enum ChangeFlag enum ChangeFlag
{ {
@ -54,9 +54,9 @@ class QskPlotItem : public QObject, public QskSkinnable
CanvasGeometryChanged = 1 << 2 CanvasGeometryChanged = 1 << 2
}; };
Q_ENUM( ChangeFlag ); Q_ENUM( ChangeFlag )
Q_DECLARE_FLAGS( ChangeFlags, ChangeFlag ); Q_DECLARE_FLAGS( ChangeFlags, ChangeFlag )
QskPlotItem( QObject* = nullptr ); QskPlotItem( QObject* = nullptr );
~QskPlotItem() override; ~QskPlotItem() override;
@ -99,7 +99,7 @@ class QskPlotItem : public QObject, public QskSkinnable
void resetDirty(); void resetDirty();
bool isDirty() const; bool isDirty() const;
virtual void updateNode( QSGNode* ); void updateNode( QSGNode* ) override;
virtual void transformationChanged( ChangeFlags ); virtual void transformationChanged( ChangeFlags );
Q_SIGNALS: Q_SIGNALS:

View File

@ -285,12 +285,12 @@ void QskPlotView::updateNode( QSGNode* node )
{ {
if ( !m_data->orphanedNodes.empty() ) if ( !m_data->orphanedNodes.empty() )
{ {
for ( auto node : m_data->orphanedNodes ) for ( auto orphanedNode : m_data->orphanedNodes )
{ {
if ( auto parentNode = node->parent() ) if ( auto parentNode = node->parent() )
parentNode->removeChildNode( node ); parentNode->removeChildNode( orphanedNode );
delete node; delete orphanedNode;
} }
m_data->orphanedNodes.clear(); m_data->orphanedNodes.clear();

View File

@ -26,7 +26,7 @@ class QSK_EXPORT QskFontRole
Headline, Headline,
Display Display
}; };
Q_ENUM( Category ); Q_ENUM( Category )
enum Emphasis : quint8 enum Emphasis : quint8
{ {
@ -38,7 +38,7 @@ class QSK_EXPORT QskFontRole
High, High,
VeryHigh VeryHigh
}; };
Q_ENUM( Emphasis ); Q_ENUM( Emphasis )
constexpr QskFontRole( Category = Body, Emphasis = Normal ) noexcept; constexpr QskFontRole( Category = Body, Emphasis = Normal ) noexcept;

View File

@ -137,7 +137,7 @@ class QSK_EXPORT QskSwipeGesture : public QskGesture
~QskSwipeGesture() override; ~QskSwipeGesture() override;
void setAngle( qreal angle ); void setAngle( qreal angle );
inline qreal angle() const { return m_angle; }; inline qreal angle() const { return m_angle; }
private: private:
qreal m_angle; qreal m_angle;

View File

@ -218,7 +218,8 @@ namespace
} }
} }
void itemChildRemoved( QQuickItem* parentItem, QQuickItem* ) void itemChildRemoved(
QQuickItem* parentItem, QQuickItem* ) override
{ {
update( parentItem ); update( parentItem );
} }

View File

@ -28,7 +28,7 @@ class QSK_EXPORT QskMainView : public QskLinearBox
void setFooter( QskControl* ); void setFooter( QskControl* );
protected: protected:
void focusInEvent( QFocusEvent* ); void focusInEvent( QFocusEvent* ) override;
private: private:
class PrivateData; class PrivateData;

View File

@ -246,8 +246,8 @@ QskAspect QskSkinHintTable::resolvedAnimator(
Q_FOREVER Q_FOREVER
{ {
auto it = m_hints->find( aspect ); auto it = m_hints->constFind( aspect );
if ( it != m_hints->cend() ) if ( it != m_hints->constEnd() )
{ {
hint = it.value().value< QskAnimationHint >(); hint = it.value().value< QskAnimationHint >();
return aspect; return aspect;

View File

@ -547,7 +547,7 @@ inline void WindowAnimator::storeAnimator(
const QskControl* control, const QskAspect aspect, const QskControl* control, const QskAspect aspect,
const QVariant& value1, const QVariant& value2, QskAnimationHint hint ) const QVariant& value1, const QVariant& value2, QskAnimationHint hint )
{ {
if ( m_animatorMap.find( aspect ) == m_animatorMap.cend() ) if ( !m_animatorMap.contains( aspect ) )
{ {
m_animatorMap.insert( aspect, m_animatorMap.insert( aspect,
HintAnimator( control, aspect, value1, value2, hint ) ); HintAnimator( control, aspect, value1, value2, hint ) );

View File

@ -446,8 +446,8 @@ void QskWindow::resizeEvent( QResizeEvent* event )
const auto newRect = qskItemGeometry( rootItem ); const auto newRect = qskItemGeometry( rootItem );
if ( newRect != oldRect ) if ( newRect != oldRect )
{ {
QskGeometryChangeEvent event( newRect, oldRect ); QskGeometryChangeEvent ev( newRect, oldRect );
QCoreApplication::sendEvent( rootItem, &event ); QCoreApplication::sendEvent( rootItem, &ev );
} }
if ( isExposed() ) if ( isExposed() )

View File

@ -85,7 +85,7 @@ class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
void updateLayout() override; void updateLayout() override;
QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const; QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
private: private:
void initButtonBox(); void initButtonBox();

View File

@ -54,7 +54,7 @@ namespace
} }
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
// make Qt 5/6 APIs matchaing // make Qt 5/6 APIs matching
QSGMaterialShader* createShader( QSGMaterialShader* createShader(
QSGRendererInterface::RenderMode ) const override final QSGRendererInterface::RenderMode ) const override final

View File

@ -32,7 +32,7 @@ namespace
{ {
} }
inline qreal map( qreal v ) const { return t + f * v; }; inline qreal map( qreal v ) const { return t + f * v; }
private: private:
const qreal t; const qreal t;

View File

@ -25,7 +25,7 @@ class QSK_EXPORT QskTreeNode final : public QSGNode
QskTreeNode( QSGNodePrivate& ); QskTreeNode( QSGNodePrivate& );
private: private:
bool m_isBlocked = false;; bool m_isBlocked = false;
}; };
QSK_EXPORT QskTreeNode* qskTreeNodeCast( QSGNode* ); QSK_EXPORT QskTreeNode* qskTreeNodeCast( QSGNode* );
@ -45,7 +45,7 @@ class QSK_EXPORT QskItemNode final : public QSGTransformNode
bool isSubtreeBlocked() const override; bool isSubtreeBlocked() const override;
private: private:
bool m_isBlocked = false;; bool m_isBlocked = false;
}; };
QSK_EXPORT QskItemNode* qskItemNodeCast( QSGNode* ); QSK_EXPORT QskItemNode* qskItemNodeCast( QSGNode* );