satisfying clang pedantic checks

This commit is contained in:
Uwe Rathmann 2017-12-07 17:04:05 +01:00
parent d55f1583ee
commit ee4317ccd4
21 changed files with 42 additions and 42 deletions

View File

@ -102,7 +102,7 @@ namespace
Q_GLOBAL_STATIC( QskWindowStore, qskReleasedWindowCounter )
class QskControlPrivate : public QQuickItemPrivate
class QskControlPrivate final : public QQuickItemPrivate
{
Q_DECLARE_PUBLIC(QskControl)

View File

@ -72,7 +72,7 @@ public:
virtual ~QskGestureEvent();
inline const QskGesture* gesture() const { return m_gesture; }
inline bool isGestureOwnedByEvent() const { return m_gestureOwnedByEvent; };
inline bool isGestureOwnedByEvent() const { return m_gestureOwnedByEvent; }
private:
const QskGesture* m_gesture;
@ -92,7 +92,7 @@ public:
virtual ~QskAnimatorEvent();
inline QskAspect::Aspect aspect() const { return m_aspect; }
inline State state() const { return m_state; };
inline State state() const { return m_state; }
private:
const QskAspect::Aspect m_aspect;

View File

@ -17,6 +17,8 @@ namespace QskObjectTree
class Visitor
{
public:
virtual ~Visitor() = default;
virtual bool visitDown( QObject* object ) = 0;
virtual bool visitUp( const QObject* object ) = 0;
};

View File

@ -15,7 +15,7 @@ class QSK_EXPORT QskPageIndicator : public QskControl
Q_OBJECT
Q_PROPERTY ( int count READ count WRITE setCount NOTIFY countChanged FINAL )
Q_PROPERTY ( int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL )
Q_PROPERTY ( qreal currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL )
Q_PROPERTY ( Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL )
using Inherited = QskControl;

View File

@ -776,7 +776,7 @@ void QskSkinnable::setSkinStateFlag( QskAspect::State state, bool on )
Starting an animator for all primitives,
that differ between the states
*/
for ( int primitive = 0; primitive <= LastPrimitive; primitive++ )
for ( uint primitive = 0; primitive <= LastPrimitive; primitive++ )
{
aspect.setPrimitive( type, primitive );

View File

@ -16,11 +16,6 @@ namespace
class StatusData
{
public:
StatusData():
isDirty( false )
{
}
StatusData( const QskGraphic& graphic ):
graphic( graphic ),
isDirty( false )

View File

@ -50,7 +50,7 @@ static Qt::Edges qskSelectedEdges( const QRectF& rect, const QPointF& pos )
return edges;
}
void qskDragWindow( const QPointF& off, Qt::Edges edges, QskSubWindow* window )
static void qskDragWindow( const QPointF& off, Qt::Edges edges, QskSubWindow* window )
{
if ( edges == 0 )
{

View File

@ -112,7 +112,7 @@ void QskDialogSubWindow::updateLayout()
QRectF rect;
rect.setSize( sizeHint() );
rect.moveCenter( QPoint( 0.5 * parentItem()->width(), 0.5 * parentItem()->height() ) );
rect.moveCenter( QPointF( 0.5 * parentItem()->width(), 0.5 * parentItem()->height() ) );
setGeometry( rect );
}

View File

@ -18,7 +18,7 @@ static inline QRgb qskSubstitutedRgb(
const QRgb rgb = rgba | QskRgbValue::AlphaMask;
for ( const auto s : substitions )
for ( const auto& s : substitions )
{
if ( rgb == s.first )
{
@ -92,7 +92,7 @@ static inline QskColorFilter qskInterpolatedFilter(
QskColorFilter interpolated;
for ( const auto pairTo : to.substitutions() )
for ( const auto& pairTo : to.substitutions() )
{
QRgb rgb = pairTo.first;
@ -117,11 +117,11 @@ static inline QskColorFilter qskInterpolatedFilter(
of the substitution in from.
*/
for ( const auto pairFrom : from.substitutions() )
for ( const auto& pairFrom : from.substitutions() )
{
bool hasRgb = false;
for ( const auto pairTo : to.substitutions() )
for ( const auto& pairTo : to.substitutions() )
{
if ( pairTo.first == pairFrom.first )
{

View File

@ -11,9 +11,11 @@
#include <QOpenGLFunctions>
// VS2012+ disable keyword macroizing unless _ALLOW_KEYWORD_MACROS is set
#ifdef _MSC_VER
#if ( _MSC_VER >= 1700 ) && !defined( _ALLOW_KEYWORD_MACROS )
#define _ALLOW_KEYWORD_MACROS
#endif
#endif
#define private public
#include <QOpenGLTexture>

View File

@ -159,8 +159,8 @@ static void qskInformationGraphic( QPainter* painter )
const double w = 40;
const double h = 50;
const QRect dotRect( 0.3 * w, 0.15 * h, 0.4 * w, 0.2 * h );
const QRect barRect( 0.3 * w, 0.4 * h, 0.4 * w, 0.5 * h );
const QRectF dotRect( 0.3 * w, 0.15 * h, 0.4 * w, 0.2 * h );
const QRectF barRect( 0.3 * w, 0.4 * h, 0.4 * w, 0.5 * h );
QPainterPath path;

View File

@ -195,7 +195,7 @@ void QskGridBox::setHorizontalSpacing( qreal spacing )
}
}
int QskGridBox::horizontalSpacing() const
qreal QskGridBox::horizontalSpacing() const
{
return engine().spacing( Qt::Horizontal );
}
@ -219,7 +219,7 @@ void QskGridBox::setVerticalSpacing( qreal spacing )
}
}
int QskGridBox::verticalSpacing() const
qreal QskGridBox::verticalSpacing() const
{
return engine().spacing( Qt::Vertical );
}

View File

@ -52,11 +52,11 @@ public:
void setHorizontalSpacing( qreal spacing );
void resetHorizontalSpacing();
int horizontalSpacing() const;
qreal horizontalSpacing() const;
void setVerticalSpacing( qreal spacing );
void resetVerticalSpacing();
int verticalSpacing() const;
qreal verticalSpacing() const;
Q_INVOKABLE void setRowSpacing( int row, qreal spacing );
Q_INVOKABLE qreal rowSpacing( int row ) const;

View File

@ -26,7 +26,7 @@ static inline qreal qskHintFor( const QQuickItem* item,
return -1;
}
static inline qreal qskHasHintFor( const QQuickItem* item, const char* method )
static inline bool qskHasHintFor( const QQuickItem* item, const char* method )
{
if ( item->metaObject()->indexOfMethod( method ) >= 0 )
{

View File

@ -12,7 +12,7 @@
class QskLinearBox::PrivateData
{
public:
PrivateData( Qt::Orientation orient, int dim ):
PrivateData( Qt::Orientation orient, uint dim ):
dimension( dim ),
orientation( orient ),
transposeAlignments( false )
@ -37,7 +37,7 @@ QskLinearBox::QskLinearBox( Qt::Orientation orientation, QQuickItem* parent ):
}
QskLinearBox::QskLinearBox( Qt::Orientation orientation,
int dimension, QQuickItem* parent ):
uint dimension, QQuickItem* parent ):
Inherited( parent ),
m_data ( new PrivateData( orientation, dimension ) )
{

View File

@ -32,7 +32,7 @@ public:
explicit QskLinearBox( QQuickItem* parent = nullptr );
explicit QskLinearBox( Qt::Orientation, QQuickItem* parent = nullptr );
QskLinearBox( Qt::Orientation, int dimension, QQuickItem* parent = nullptr );
QskLinearBox( Qt::Orientation, uint dimension, QQuickItem* parent = nullptr );
virtual ~QskLinearBox();

View File

@ -38,7 +38,7 @@ QRectF QskPlainTextRenderer::textRect( const QString& text,
const QFont& font, const QskTextOptions& options, const QSizeF& size )
{
const QFontMetricsF fm( font );
const QRect r( 0, 0, size.width(), size.height() );
const QRectF r( 0, 0, size.width(), size.height() );
return fm.boundingRect( r, options.textFlags(), text );
}

View File

@ -57,9 +57,6 @@ namespace
setWrapMode( static_cast< QQuickText::WrapMode >( options.wrapMode() ) );
}
void refWindow( QQuickWindow* window );
void derefWindow();
void begin() { classBegin(); }
void end() { componentComplete(); }

View File

@ -35,13 +35,13 @@ namespace
virtual QSGMaterialType* type() const override;
virtual QSGMaterialShader* createShader() const override;
void setTextureId(int );
int textureId() const;
void setTextureId( uint );
uint textureId() const;
virtual int compare(const QSGMaterial* ) const override;
private:
int m_textureId;
uint m_textureId;
const bool m_isOpaque : 1;
};
@ -101,12 +101,12 @@ namespace
setFlag(Blending, true ); // alpha blending
}
void Material::setTextureId( int id )
void Material::setTextureId( uint id )
{
m_textureId = id;
}
int Material::textureId() const
uint Material::textureId() const
{
return m_textureId;
}
@ -133,11 +133,15 @@ namespace
int Material::compare( const QSGMaterial* other ) const
{
const auto otherMaterial = static_cast< const Material* >( other );
return m_textureId - otherMaterial->m_textureId;
if ( m_textureId == otherMaterial->m_textureId )
return 0;
return ( m_textureId > otherMaterial->m_textureId ) ? 1 : -1;
}
}
class QskTextureNodePrivate : public QSGGeometryNodePrivate
class QskTextureNodePrivate final : public QSGGeometryNodePrivate
{
public:
QskTextureNodePrivate():
@ -199,7 +203,7 @@ QRectF QskTextureNode::rect() const
return d->rect;
}
void QskTextureNode::setTextureId( int textureId )
void QskTextureNode::setTextureId( uint textureId )
{
Q_D( QskTextureNode );
@ -227,7 +231,7 @@ void QskTextureNode::setTextureId( int textureId )
markDirty( dirty );
}
int QskTextureNode::textureId() const
uint QskTextureNode::textureId() const
{
Q_D( const QskTextureNode );
return d->material.textureId();

View File

@ -22,8 +22,8 @@ public:
void setRect(const QRectF& rect);
QRectF rect() const;
void setTextureId( int id );
int textureId() const;
void setTextureId( uint id );
uint textureId() const;
void setMirrored( Qt::Orientations );
Qt::Orientations mirrored() const;

View File

@ -44,7 +44,7 @@ static const int qskDuration = 150;
static inline QColor qskShadedColor( const QColor color, qreal opacity )
{
QColor c = color;
c.setAlpha( 255 * opacity );
c.setAlphaF( opacity );
return c;
}