using std::as_const to avoid deprecation warnings

This commit is contained in:
Uwe Rathmann 2023-07-20 08:36:07 +02:00
parent d43d6bfce2
commit eb0bac4927
11 changed files with 16 additions and 16 deletions

View File

@ -230,7 +230,7 @@ inline const QskGradientStops& QskGradient::stops() const noexcept
#if 1
/*
Returning a const& so that it is possible to write:
for ( const auto& stop : qAsConst( gradient.stops() ) )
for ( const auto& stop : gradient.stops() )
Once we have changed QskGradientStop from QColor to QRgb
we should check if there is a better solution possible

View File

@ -162,7 +162,7 @@ void CounterHook::addObject( QObject* object )
{
const bool isItem = qskIsItem( object );
for ( auto counterData : qAsConst( m_counterDataSet ) )
for ( auto counterData : std::as_const( m_counterDataSet ) )
{
counterData->counter[ QskObjectCounter::Objects ].increment();
@ -182,7 +182,7 @@ void CounterHook::removeObject( QObject* object )
{
const bool isItem = qskIsItem( object );
for ( auto counterData : qAsConst( m_counterDataSet ) )
for ( auto counterData : std::as_const( m_counterDataSet ) )
{
counterData->counter[ QskObjectCounter::Objects ].decrement();

View File

@ -57,7 +57,7 @@ class QskFocusIndicator::PrivateData
public:
void resetConnections()
{
for ( const auto& connection : qAsConst( connections ) )
for ( const auto& connection : std::as_const( connections ) )
QObject::disconnect( connection );
connections.clear();

View File

@ -132,7 +132,7 @@ namespace
{
Timer* timer = nullptr;
for ( auto t : qAsConst( m_table ) )
for ( auto t : std::as_const( m_table ) )
{
if ( t->recognizer() == nullptr ||
t->recognizer() == recognizer )
@ -153,7 +153,7 @@ namespace
void stopTimer( const QskGestureRecognizer* recognizer )
{
for ( auto timer : qAsConst( m_table ) )
for ( auto timer : std::as_const( m_table ) )
{
if ( timer->recognizer() == recognizer )
{

View File

@ -463,7 +463,7 @@ void qskItemUpdateRecursive( QQuickItem* item )
static const QQuickPointerTouchEvent* qskPointerPressEvent( const QQuickWindowPrivate* wd )
{
for ( const auto event : qAsConst( wd->pointerEventInstances ) )
for ( const auto event : std::as_const( wd->pointerEventInstances ) )
{
if ( auto touchEvent = event->asPointerTouchEvent() )
{

View File

@ -173,7 +173,7 @@ void QskShortcutHandler::remove( int id )
Finally let's check if we can disconnect
from the destroyed signals
*/
for ( const auto& entry : qAsConst( m_invokeDataMap ) )
for ( const auto& entry : std::as_const( m_invokeDataMap ) )
{
if ( item == nullptr && receiver == nullptr )
break;
@ -276,7 +276,7 @@ bool QskShortcutHandler::invoke( QQuickItem* item, const QKeySequence& sequence
{
bool found = false;
for ( const auto& entry : qAsConst( m_invokeDataMap ) )
for ( const auto& entry : std::as_const( m_invokeDataMap ) )
{
auto& data = entry.second;

View File

@ -365,7 +365,7 @@ class QskSkinManager::PrivateData
{
if ( !pluginsRegistered )
{
for ( const auto& path : qAsConst( pluginPaths ) )
for ( const auto& path : std::as_const( pluginPaths ) )
registerPlugins( path + QStringLiteral( "/skins" ) );
pluginsRegistered = true;

View File

@ -368,7 +368,7 @@ void QskSkinlet::updateNode( QskSkinnable* skinnable, QSGNode* parentNode ) cons
replaceChildNode( DebugRole, parentNode, oldNode, newNode );
}
for ( const auto nodeRole : qAsConst( m_data->nodeRoles ) )
for ( const auto nodeRole : std::as_const( m_data->nodeRoles ) )
{
Q_ASSERT( nodeRole < FirstReservedRole );

View File

@ -118,7 +118,7 @@ QskDialogButtonBox::~QskDialogButtonBox()
{
for ( int i = 0; i < QskDialog::NActionRoles; i++ )
{
for ( auto button : qAsConst( m_data->buttons[ i ] ) )
for ( auto button : std::as_const( m_data->buttons[ i ] ) )
{
/*
The destructor of QQuickItem sets the parentItem of

View File

@ -568,7 +568,7 @@ QRectF QskGraphic::scaledBoundingRect( qreal sx, qreal sy ) const
QRectF rect = transform.mapRect( m_data->pointRect );
for ( const auto& info : qAsConst( m_data->pathInfos ) )
for ( const auto& info : std::as_const( m_data->pathInfos ) )
rect |= info.scaledBoundingRect( sx, sy, scalePens );
return rect;
@ -681,7 +681,7 @@ void QskGraphic::render( QPainter* painter, const QRectF& rect,
const bool scalePens = !( m_data->renderHints & RenderPensUnscaled );
for ( const auto& info : qAsConst( m_data->pathInfos ) )
for ( const auto& info : std::as_const( m_data->pathInfos ) )
{
const qreal ssx = info.scaleFactorX( m_data->pointRect,
rect, m_data->boundingRect, scalePens );

View File

@ -318,7 +318,7 @@ void QskStackBox::autoRemoveItem( QQuickItem* item )
void QskStackBox::clear( bool autoDelete )
{
for ( const auto item : qAsConst( m_data->items ) )
for ( const auto item : std::as_const( m_data->items ) )
{
if( autoDelete && ( item->parent() == this ) )
delete item;
@ -380,7 +380,7 @@ QSizeF QskStackBox::layoutSizeHint(
qreal w = -1.0;
qreal h = -1.0;
for ( const auto item : qAsConst( m_data->items ) )
for ( const auto item : std::as_const( m_data->items ) )
{
/*
We ignore the retainSizeWhenVisible flag and include all