satisfying clang compiler checks

This commit is contained in:
Uwe Rathmann 2017-12-07 17:12:52 +01:00
parent ee4317ccd4
commit a122b19df0
6 changed files with 20 additions and 19 deletions

View File

@ -933,7 +933,7 @@ void QskInputPanel::updateKeyData()
auto& row = keyLayout.data[i]; auto& row = keyLayout.data[i];
auto& keyDataRow = keyDataLayout.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 xPos = 0;
qreal keyWidth = baseKeyWidth; qreal keyWidth = baseKeyWidth;

View File

@ -208,7 +208,6 @@ void QskListView::keyPressEvent( QKeyEvent* event )
{ {
// TODO ... // TODO ...
return Inherited::keyPressEvent( event ); return Inherited::keyPressEvent( event );
break;
} }
default: default:
{ {
@ -224,7 +223,7 @@ void QskListView::keyPressEvent( QKeyEvent* event )
if ( row != r ) if ( row != r )
{ {
const int rowPos = row * rowHeight(); const qreal rowPos = row * rowHeight();
if ( rowPos < scrollPos().y() ) if ( rowPos < scrollPos().y() )
{ {
setScrollPos( QPointF( scrollPos().x(), rowPos ) ); setScrollPos( QPointF( scrollPos().x(), rowPos ) );
@ -275,13 +274,13 @@ void QskListView::updateScrollableSize()
{ {
const double h = rowCount() * rowHeight(); const double h = rowCount() * rowHeight();
double w = 0.0; qreal w = 0.0;
for ( int col = 0; col < columnCount(); col++ ) for ( int col = 0; col < columnCount(); col++ )
w += columnWidth( col ); w += columnWidth( col );
const QSizeF sz = scrollableSize(); const QSizeF sz = scrollableSize();
setScrollableSize( QSize( w, h ) ); setScrollableSize( QSizeF( w, h ) );
if ( m_data->preferredWidthFromColumns && if ( m_data->preferredWidthFromColumns &&
sz.width() != scrollableSize().width() ) sz.width() != scrollableSize().width() )

View File

@ -114,7 +114,7 @@ void QskListViewSkinlet::updateBackgroundNodes(
{ {
QSGNode* backgroundNode = listViewNode->backgroundNode(); QSGNode* backgroundNode = listViewNode->backgroundNode();
const int cellHeight = listView->rowHeight(); const qreal cellHeight = listView->rowHeight();
const QRectF viewRect = listView->viewContentsRect(); const QRectF viewRect = listView->viewContentsRect();
const QPointF scrolledPos = listView->scrollPos(); const QPointF scrolledPos = listView->scrollPos();

View File

@ -29,17 +29,17 @@
static const int qskBackgroundRole = 254; static const int qskBackgroundRole = 254;
static const int qskDebugRole = 253; 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 ); 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 ); const QSGNode::Flags flags = qskNodeFlags( nodeRole );
node->setFlags( node->flags() | flags ); 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++ ) 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 Q_ASSERT( nodeRole <= 245 ); // reserving 10 roles
@ -269,7 +269,7 @@ QSGNode* QskSkinlet::updateDebugNode(
} }
void QskSkinlet::insertRemoveNodes( QSGNode* parentNode, void QskSkinlet::insertRemoveNodes( QSGNode* parentNode,
QSGNode* oldNode, QSGNode* newNode, int nodeRole ) const QSGNode* oldNode, QSGNode* newNode, quint8 nodeRole ) const
{ {
if ( newNode && newNode->parent() != parentNode ) if ( newNode && newNode->parent() != parentNode )
{ {
@ -321,7 +321,7 @@ void QskSkinlet::insertNodeSorted( QSGNode* node, QSGNode* parentNode ) const
for ( QSGNode* childNode = parentNode->lastChild(); for ( QSGNode* childNode = parentNode->lastChild();
childNode != nullptr; childNode = childNode->previousSibling() ) childNode != nullptr; childNode = childNode->previousSibling() )
{ {
const quint8 childNodeRole = qskRole( childNode ); const auto childNodeRole = qskRole( childNode );
if ( childNodeRole == qskBackgroundRole ) if ( childNodeRole == qskBackgroundRole )
{ {
sibling = childNode; sibling = childNode;
@ -475,7 +475,7 @@ QSGNode* QskSkinlet::updateTextNode(
break; break;
case QskTextOptions::VerticalFit: case QskTextOptions::VerticalFit:
font.setPixelSize( rect.height() * 0.5 ); font.setPixelSize( static_cast<int>( rect.height() * 0.5 ) );
break; break;
case QskTextOptions::Fit: case QskTextOptions::Fit:

View File

@ -95,7 +95,7 @@ protected:
const QskGraphic&, QskAspect::Subcontrol ) const; const QskGraphic&, QskAspect::Subcontrol ) const;
void insertRemoveNodes( QSGNode* parentNode, void insertRemoveNodes( QSGNode* parentNode,
QSGNode* oldNode, QSGNode* newNode, int nodeRole ) const; QSGNode* oldNode, QSGNode* newNode, quint8 nodeRole ) const;
private: private:
void insertNodeSorted( QSGNode* node, QSGNode* parentNode ) const; void insertNodeSorted( QSGNode* node, QSGNode* parentNode ) const;

View File

@ -117,14 +117,16 @@ QSize QskGraphicImageProvider::effectiveSize(
if ( requestedSize.height() < 0 ) if ( requestedSize.height() < 0 )
{ {
const double f = requestedSize.width() / defaultSize.width(); const auto f = requestedSize.width() / defaultSize.width();
return QSize( requestedSize.width(), f * defaultSize.height() ); return QSize( requestedSize.width(),
static_cast<int>( f * defaultSize.height() ) );
} }
if ( requestedSize.width() < 0 ) if ( requestedSize.width() < 0 )
{ {
const double f = requestedSize.height() / defaultSize.height(); const auto f = requestedSize.height() / defaultSize.height();
return QSize( f * defaultSize.width(), requestedSize.height() ); return QSize( f * defaultSize.width(),
static_cast< int >( requestedSize.height() ) );
} }
return defaultSize.toSize(); return defaultSize.toSize();