From a122b19df0ee9c65df9f43bb316e5d74df7c9c18 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 7 Dec 2017 17:12:52 +0100 Subject: [PATCH] satisfying clang compiler checks --- src/controls/QskInputPanel.cpp | 2 +- src/controls/QskListView.cpp | 7 +++---- src/controls/QskListViewSkinlet.cpp | 2 +- src/controls/QskSkinlet.cpp | 16 ++++++++-------- src/controls/QskSkinlet.h | 2 +- src/graphic/QskGraphicImageProvider.cpp | 10 ++++++---- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/controls/QskInputPanel.cpp b/src/controls/QskInputPanel.cpp index 7671bb93..eedfe7e3 100644 --- a/src/controls/QskInputPanel.cpp +++ b/src/controls/QskInputPanel.cpp @@ -933,7 +933,7 @@ void QskInputPanel::updateKeyData() auto& row = keyLayout.data[i]; auto& keyDataRow = keyDataLayout.data[ i ]; - const auto baseKeyWidth = 1.0f / qskRowStretch( row ); + const auto baseKeyWidth = 1.0 / qskRowStretch( row ); qreal xPos = 0; qreal keyWidth = baseKeyWidth; diff --git a/src/controls/QskListView.cpp b/src/controls/QskListView.cpp index 7fd4fa03..da92d755 100644 --- a/src/controls/QskListView.cpp +++ b/src/controls/QskListView.cpp @@ -208,7 +208,6 @@ void QskListView::keyPressEvent( QKeyEvent* event ) { // TODO ... return Inherited::keyPressEvent( event ); - break; } default: { @@ -224,7 +223,7 @@ void QskListView::keyPressEvent( QKeyEvent* event ) if ( row != r ) { - const int rowPos = row * rowHeight(); + const qreal rowPos = row * rowHeight(); if ( rowPos < scrollPos().y() ) { setScrollPos( QPointF( scrollPos().x(), rowPos ) ); @@ -275,13 +274,13 @@ void QskListView::updateScrollableSize() { const double h = rowCount() * rowHeight(); - double w = 0.0; + qreal w = 0.0; for ( int col = 0; col < columnCount(); col++ ) w += columnWidth( col ); const QSizeF sz = scrollableSize(); - setScrollableSize( QSize( w, h ) ); + setScrollableSize( QSizeF( w, h ) ); if ( m_data->preferredWidthFromColumns && sz.width() != scrollableSize().width() ) diff --git a/src/controls/QskListViewSkinlet.cpp b/src/controls/QskListViewSkinlet.cpp index 87b0c940..56b86fec 100644 --- a/src/controls/QskListViewSkinlet.cpp +++ b/src/controls/QskListViewSkinlet.cpp @@ -114,7 +114,7 @@ void QskListViewSkinlet::updateBackgroundNodes( { QSGNode* backgroundNode = listViewNode->backgroundNode(); - const int cellHeight = listView->rowHeight(); + const qreal cellHeight = listView->rowHeight(); const QRectF viewRect = listView->viewContentsRect(); const QPointF scrolledPos = listView->scrollPos(); diff --git a/src/controls/QskSkinlet.cpp b/src/controls/QskSkinlet.cpp index 475ebb8c..bf54815f 100644 --- a/src/controls/QskSkinlet.cpp +++ b/src/controls/QskSkinlet.cpp @@ -29,17 +29,17 @@ static const int qskBackgroundRole = 254; static const int qskDebugRole = 253; -static inline QSGNode::Flags qskNodeFlags( int nodeRole ) +static inline QSGNode::Flags qskNodeFlags( quint8 nodeRole ) { return static_cast< QSGNode::Flags >( ( nodeRole + 1 ) << 8 ); } -static inline int qskRole( const QSGNode* node ) +static inline quint8 qskRole( const QSGNode* node ) { - return ( ( node->flags() & 0x0ffff ) >> 8 ) - 1; + return static_cast< quint8 >( ( ( node->flags() & 0x0ffff ) >> 8 ) - 1 ); } -static inline void qskSetRole( int nodeRole, QSGNode* node ) +static inline void qskSetRole( quint8 nodeRole, QSGNode* node ) { const QSGNode::Flags flags = qskNodeFlags( nodeRole ); node->setFlags( node->flags() | flags ); @@ -199,7 +199,7 @@ void QskSkinlet::updateNode( QskSkinnable* skinnable, QSGNode* parentNode ) cons for ( int i = 0; i < m_data->nodeRoles.size(); i++ ) { - const int nodeRole = m_data->nodeRoles[i]; + const auto nodeRole = m_data->nodeRoles[i]; Q_ASSERT( nodeRole <= 245 ); // reserving 10 roles @@ -269,7 +269,7 @@ QSGNode* QskSkinlet::updateDebugNode( } void QskSkinlet::insertRemoveNodes( QSGNode* parentNode, - QSGNode* oldNode, QSGNode* newNode, int nodeRole ) const + QSGNode* oldNode, QSGNode* newNode, quint8 nodeRole ) const { if ( newNode && newNode->parent() != parentNode ) { @@ -321,7 +321,7 @@ void QskSkinlet::insertNodeSorted( QSGNode* node, QSGNode* parentNode ) const for ( QSGNode* childNode = parentNode->lastChild(); childNode != nullptr; childNode = childNode->previousSibling() ) { - const quint8 childNodeRole = qskRole( childNode ); + const auto childNodeRole = qskRole( childNode ); if ( childNodeRole == qskBackgroundRole ) { sibling = childNode; @@ -475,7 +475,7 @@ QSGNode* QskSkinlet::updateTextNode( break; case QskTextOptions::VerticalFit: - font.setPixelSize( rect.height() * 0.5 ); + font.setPixelSize( static_cast( rect.height() * 0.5 ) ); break; case QskTextOptions::Fit: diff --git a/src/controls/QskSkinlet.h b/src/controls/QskSkinlet.h index f2c50c09..4527b95e 100644 --- a/src/controls/QskSkinlet.h +++ b/src/controls/QskSkinlet.h @@ -95,7 +95,7 @@ protected: const QskGraphic&, QskAspect::Subcontrol ) const; void insertRemoveNodes( QSGNode* parentNode, - QSGNode* oldNode, QSGNode* newNode, int nodeRole ) const; + QSGNode* oldNode, QSGNode* newNode, quint8 nodeRole ) const; private: void insertNodeSorted( QSGNode* node, QSGNode* parentNode ) const; diff --git a/src/graphic/QskGraphicImageProvider.cpp b/src/graphic/QskGraphicImageProvider.cpp index 5842a908..257c2f66 100644 --- a/src/graphic/QskGraphicImageProvider.cpp +++ b/src/graphic/QskGraphicImageProvider.cpp @@ -117,14 +117,16 @@ QSize QskGraphicImageProvider::effectiveSize( if ( requestedSize.height() < 0 ) { - const double f = requestedSize.width() / defaultSize.width(); - return QSize( requestedSize.width(), f * defaultSize.height() ); + const auto f = requestedSize.width() / defaultSize.width(); + return QSize( requestedSize.width(), + static_cast( f * defaultSize.height() ) ); } if ( requestedSize.width() < 0 ) { - const double f = requestedSize.height() / defaultSize.height(); - return QSize( f * defaultSize.width(), requestedSize.height() ); + const auto f = requestedSize.height() / defaultSize.height(); + return QSize( f * defaultSize.width(), + static_cast< int >( requestedSize.height() ) ); } return defaultSize.toSize();