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( -Woverloaded-virtual )
add_compile_options( -Wfloat-equal )
# add_compile_options( -Wfloat-equal )
if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -547,7 +547,7 @@ inline void WindowAnimator::storeAnimator(
const QskControl* control, const QskAspect aspect,
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,
HintAnimator( control, aspect, value1, value2, hint ) );

View File

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

View File

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

View File

@ -54,7 +54,7 @@ namespace
}
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
// make Qt 5/6 APIs matchaing
// make Qt 5/6 APIs matching
QSGMaterialShader* createShader(
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:
const qreal t;

View File

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