using C++ auto

This commit is contained in:
Uwe Rathmann 2021-10-27 13:02:18 +02:00
parent 6194f947b8
commit 303dd2f25d

View File

@ -30,7 +30,7 @@ Window::Window( Qt::Orientation orientation )
void Window::addBox( QskDialog::Actions actions ) void Window::addBox( QskDialog::Actions actions )
{ {
QskDialogButtonBox* box = new QskDialogButtonBox( m_orientation ); auto box = new QskDialogButtonBox( m_orientation );
box->setActions( actions ); box->setActions( actions );
box->setObjectName( "DialogBox" ); box->setObjectName( "DialogBox" );
@ -39,10 +39,10 @@ void Window::addBox( QskDialog::Actions actions )
void Window::addActionBox() void Window::addActionBox()
{ {
QskPushButton* flipButton = new QskPushButton( "Flip" ); auto flipButton = new QskPushButton( "Flip" );
QskPushButton* centerButton = new QskPushButton( "Center" ); auto centerButton = new QskPushButton( "Center" );
QskDialogButtonBox* box = new QskDialogButtonBox( m_orientation ); auto box = new QskDialogButtonBox( m_orientation );
box->addButton( flipButton, QskDialog::UserRole ); box->addButton( flipButton, QskDialog::UserRole );
box->addButton( centerButton, QskDialog::UserRole ); box->addButton( centerButton, QskDialog::UserRole );
box->setObjectName( "UserBox" ); box->setObjectName( "UserBox" );
@ -62,8 +62,8 @@ void Window::flipOrientation()
m_orientation = invertedOrientation(); m_orientation = invertedOrientation();
const QVector< QskDialogButtonBox* > boxes = dialogBoxes(); const auto boxes = dialogBoxes();
for ( QskDialogButtonBox* box : boxes ) for ( auto box : boxes )
{ {
box->setOrientation( m_orientation ); box->setOrientation( m_orientation );
box->setParent( nullptr ); box->setParent( nullptr );
@ -79,8 +79,8 @@ void Window::flipOrientation()
void Window::centerButtons() void Window::centerButtons()
{ {
const QVector< QskDialogButtonBox* > boxes = dialogBoxes(); const auto boxes = dialogBoxes();
for ( QskDialogButtonBox* box : boxes ) for ( auto box : boxes )
box->setCenteredButtons( !box->centeredButtons() ); box->setCenteredButtons( !box->centeredButtons() );
} }