more accurate capturing for lambdas
This commit is contained in:
parent
d63fae938d
commit
2500f5c8c4
@ -370,7 +370,7 @@ public:
|
||||
setAlignment( button, Qt::AlignCenter );
|
||||
|
||||
connect( button, &QskPushButton::pressed,
|
||||
this, [ = ]() { shift( button->offset() ); } );
|
||||
this, [ this, button ]() { shift( button->offset() ); } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,11 +91,11 @@ FlowLayoutPage::FlowLayoutPage( QQuickItem* parent ):
|
||||
Box* box = new Box();
|
||||
|
||||
ButtonBox* buttonBox = new ButtonBox();
|
||||
buttonBox->addButton( "Flip", [ = ]() { box->transpose(); } );
|
||||
buttonBox->addButton( "Mirror", [ = ]() { box->mirror(); } );
|
||||
buttonBox->addButton( "Rotate", [ = ]() { box->rotate(); } );
|
||||
buttonBox->addButton( "Dim+", [ = ]() { box->incrementDimension( +1 ); } );
|
||||
buttonBox->addButton( "Dim-", [ = ]() { box->incrementDimension( -1 ); } );
|
||||
buttonBox->addButton( "Flip", [ box ]() { box->transpose(); } );
|
||||
buttonBox->addButton( "Mirror", [ box ]() { box->mirror(); } );
|
||||
buttonBox->addButton( "Rotate", [ box ]() { box->rotate(); } );
|
||||
buttonBox->addButton( "Dim+", [ box ]() { box->incrementDimension( +1 ); } );
|
||||
buttonBox->addButton( "Dim-", [ box ]() { box->incrementDimension( -1 ); } );
|
||||
|
||||
addItem( buttonBox, Qt::AlignTop | Qt::AlignLeft );
|
||||
addItem( box );
|
||||
|
@ -90,11 +90,11 @@ LinearLayoutPage::LinearLayoutPage( QQuickItem* parent ):
|
||||
Box* box = new Box();
|
||||
|
||||
ButtonBox* buttonBox = new ButtonBox();
|
||||
buttonBox->addButton( "Flip", [ = ]() { box->transpose(); } );
|
||||
buttonBox->addButton( "Mirror", [ = ]() { box->mirror(); } );
|
||||
buttonBox->addButton( "Rotate", [ = ]() { box->rotate(); } );
|
||||
buttonBox->addButton( "Spacing+", [ = ]() { box->incrementSpacing( +1 ); }, true );
|
||||
buttonBox->addButton( "Spacing-", [ = ]() { box->incrementSpacing( -1 ); }, true );
|
||||
buttonBox->addButton( "Flip", [ box ]() { box->transpose(); } );
|
||||
buttonBox->addButton( "Mirror", [ box ]() { box->mirror(); } );
|
||||
buttonBox->addButton( "Rotate", [ box ]() { box->rotate(); } );
|
||||
buttonBox->addButton( "Spacing+", [ box ]() { box->incrementSpacing( +1 ); }, true );
|
||||
buttonBox->addButton( "Spacing-", [ box ]() { box->incrementSpacing( -1 ); }, true );
|
||||
|
||||
addItem( buttonBox, Qt::AlignTop | Qt::AlignLeft );
|
||||
addItem( box );
|
||||
|
@ -107,11 +107,11 @@ StackLayoutPage::StackLayoutPage( QQuickItem* parent ):
|
||||
auto* box = new Box();
|
||||
|
||||
auto* buttonBox = new ButtonBox();
|
||||
buttonBox->addButton( "<<", [ = ]() { box->incrementScrolling( Qt::Horizontal, +1 ); } );
|
||||
buttonBox->addButton( ">>", [ = ]() { box->incrementScrolling( Qt::Horizontal, -1 ); } );
|
||||
buttonBox->addButton( "^", [ = ]() { box->incrementScrolling( Qt::Vertical, -1 ); } );
|
||||
buttonBox->addButton( "v", [ = ]() { box->incrementScrolling( Qt::Vertical, +1 ); } );
|
||||
buttonBox->addButton( "Fading", [ = ]() { box->incrementFading( +1 ); } );
|
||||
buttonBox->addButton( "<<", [ box ]() { box->incrementScrolling( Qt::Horizontal, +1 ); } );
|
||||
buttonBox->addButton( ">>", [ box ]() { box->incrementScrolling( Qt::Horizontal, -1 ); } );
|
||||
buttonBox->addButton( "^", [ box ]() { box->incrementScrolling( Qt::Vertical, -1 ); } );
|
||||
buttonBox->addButton( "v", [ box ]() { box->incrementScrolling( Qt::Vertical, +1 ); } );
|
||||
buttonBox->addButton( "Fading", [ box ]() { box->incrementFading( +1 ); } );
|
||||
|
||||
auto pageIndicator = new QskPageIndicator();
|
||||
pageIndicator->setCount( box->itemCount() );
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
0.5 * ( slider->maximum() - slider->minimum() ) );
|
||||
#if 0
|
||||
connect( slider, &QskSlider::valueChanged,
|
||||
[ = ]( qreal value ) { qDebug() << value; } );
|
||||
[]( qreal value ) { qDebug() << value; } );
|
||||
#endif
|
||||
setAlignment( slider, Qt::AlignCenter );
|
||||
}
|
||||
|
@ -98,10 +98,10 @@ public:
|
||||
// 2) QskInputPanel does not work properly in the threaded environment
|
||||
#if 1
|
||||
connect( this, &QskListView::selectedRowChanged,
|
||||
this, [ = ] { qskSetup->inputPanel()->setLocale( m_values[selectedRow()].second ); } );
|
||||
this, [ this ] { qskSetup->inputPanel()->setLocale( m_values[selectedRow()].second ); } );
|
||||
#else
|
||||
connect( this, &QskListView::selectedRowChanged,
|
||||
this, [ = ] { QLocale::setDefault( m_values[selectedRow()].second ); } );
|
||||
this, [ this ] { QLocale::setDefault( m_values[selectedRow()].second ); } );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -140,13 +140,13 @@ void QskAnimatorDriver::registerAnimator( QskAnimator* animator )
|
||||
m_windows += window;
|
||||
|
||||
connect( window, &QQuickWindow::afterAnimating,
|
||||
this, [ = ]() { advanceAnimators( window ); } );
|
||||
this, [ this, window ]() { advanceAnimators( window ); } );
|
||||
|
||||
connect( window, &QQuickWindow::frameSwapped,
|
||||
this, [ = ]() { scheduleUpdate( window ); } );
|
||||
this, [ this, window ]() { scheduleUpdate( window ); } );
|
||||
|
||||
connect( window, &QObject::destroyed,
|
||||
this, [ = ]( QObject* ) { removeWindow( window ); } );
|
||||
this, [ this, window ]( QObject* ) { removeWindow( window ); } );
|
||||
|
||||
window->update();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void QskDirtyItemFilter::addWindow( QQuickWindow* window )
|
||||
*/
|
||||
|
||||
connect( window, &QQuickWindow::beforeSynchronizing,
|
||||
window, [ = ] { beforeSynchronizing( window ); },
|
||||
window, [ this, window ] { beforeSynchronizing( window ); },
|
||||
Qt::DirectConnection );
|
||||
|
||||
connect( window, &QObject::destroyed, this, &QskDirtyItemFilter::cleanUp );
|
||||
|
@ -125,9 +125,9 @@ void QskSubWindowArea::itemChange( QQuickItem::ItemChange change,
|
||||
case QQuickItem::ItemChildAddedChange:
|
||||
{
|
||||
// the child is not fully constructed
|
||||
// and we have delay checking for sub windows
|
||||
// and we have to delay checking for sub windows
|
||||
QTimer::singleShot( 0, this,
|
||||
[ = ] { qskUpdateEventFilter( this ); } );
|
||||
[ this ] { qskUpdateEventFilter( this ); } );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -133,11 +133,11 @@ int QskTabBar::insertTab( int index, QskTabButton* button )
|
||||
button->setTextOptions( m_data->textOptions );
|
||||
|
||||
auto onTabSelected =
|
||||
[ = ] ( bool on )
|
||||
[ this, button ] ( bool on )
|
||||
{
|
||||
if ( on )
|
||||
{
|
||||
int pos = indexOf( button );
|
||||
const int pos = indexOf( button );
|
||||
if ( pos >= 0 && pos != m_data->currentIndex )
|
||||
{
|
||||
m_data->currentIndex = pos;
|
||||
|
Loading…
x
Reference in New Issue
Block a user