Skip to content

Commit

Permalink
More tweaks (am I opening a flood gate?!)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 2, 2025
1 parent c44bfb3 commit 3d3f9b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/trackingmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ QModelIndex TrackingModel::parent( const QModelIndex &index ) const
int TrackingModel::rowCount( const QModelIndex &parent ) const
{
Q_UNUSED( parent )
return mTrackers.size();
return static_cast<int>( mTrackers.size() );
}

int TrackingModel::columnCount( const QModelIndex &parent ) const
Expand Down
4 changes: 2 additions & 2 deletions src/core/valuemapmodelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void ValueMapModelBase::setMap( const QVariant &map )
const QVariantMap valueMap = map.toMap();
if ( !valueMap.empty() )
{
beginInsertRows( QModelIndex(), 0, valueMap.size() - 1 );
beginInsertRows( QModelIndex(), 0, static_cast<int>( valueMap.size() ) - 1 );

QMapIterator<QString, QVariant> i( valueMap );
while ( i.hasNext() )
Expand All @@ -77,7 +77,7 @@ void ValueMapModelBase::setMap( const QVariant &map )
int ValueMapModelBase::rowCount( const QModelIndex &parent ) const
{
Q_UNUSED( parent )
return mMap.size();
return static_cast<int>( mMap.size() );
}

QVariant ValueMapModelBase::data( const QModelIndex &index, int role ) const
Expand Down
12 changes: 7 additions & 5 deletions src/core/vertexmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void VertexModel::createCandidates()
if ( ( r == 0 || mVertices.at( r - 1 ).ring != vertex.ring ) && mGeometryType == Qgis::GeometryType::Polygon )
{
Vertex lastVertex;
for ( int i = r + 1; i < mVertices.count(); i++ )
for ( qsizetype i = r + 1; i < mVertices.count(); i++ )
{
if ( mVertices.at( i ).ring != vertex.ring )
break;
Expand Down Expand Up @@ -670,7 +670,7 @@ void VertexModel::removeCurrentVertex()

void VertexModel::updateGeometry( const QgsGeometry &geometry )
{
int preservedIndex = mCurrentIndex;
qsizetype preservedIndex = mCurrentIndex;
setGeometry( geometry );
//since the index is shifted after reload, we decrement
setCurrentVertex( preservedIndex - 1 );
Expand Down Expand Up @@ -737,7 +737,8 @@ void VertexModel::setCurrentVertex( qsizetype newVertex, bool forceUpdate )
if ( mCurrentIndex >= 0 && mCurrentIndex < mVertices.count() )
{
mVertices[mCurrentIndex].currentVertex = false;
emit dataChanged( index( mCurrentIndex, 0, QModelIndex() ), index( mCurrentIndex, 0, QModelIndex() ) );
const QModelIndex changedIndex = index( static_cast<int>( mCurrentIndex ), 0, QModelIndex() );
emit dataChanged( changedIndex, changedIndex );
}

if ( mVertices.count() == 0 )
Expand All @@ -762,7 +763,8 @@ void VertexModel::setCurrentVertex( qsizetype newVertex, bool forceUpdate )
if ( mCurrentIndex >= 0 && mCurrentIndex < mVertices.count() )
{
mVertices[mCurrentIndex].currentVertex = true;
emit dataChanged( index( mCurrentIndex, 0, QModelIndex() ), index( mCurrentIndex, 0, QModelIndex() ) );
const QModelIndex changedIndex = index( static_cast<int>( mCurrentIndex ), 0, QModelIndex() );
emit dataChanged( changedIndex, changedIndex );
}

emit currentVertexIndexChanged();
Expand All @@ -781,7 +783,7 @@ void VertexModel::setCurrentVertexIndex( qsizetype currentIndex )

int VertexModel::currentVertexIndex() const
{
return mCurrentIndex;
return static_cast<int>( mCurrentIndex );
}

int VertexModel::vertexCount() const
Expand Down

1 comment on commit 3d3f9b8

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.