summaryrefslogtreecommitdiffstats
path: root/examples/widgets/layouts/dynamiclayouts/dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/layouts/dynamiclayouts/dialog.cpp')
-rw-r--r--examples/widgets/layouts/dynamiclayouts/dialog.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/examples/widgets/layouts/dynamiclayouts/dialog.cpp b/examples/widgets/layouts/dynamiclayouts/dialog.cpp
index 080d69204b..f46053372a 100644
--- a/examples/widgets/layouts/dynamiclayouts/dialog.cpp
+++ b/examples/widgets/layouts/dynamiclayouts/dialog.cpp
@@ -55,12 +55,12 @@
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
- createRotableGroupBox();
+ createRotatableGroupBox();
createOptionsGroupBox();
createButtonBox();
mainLayout = new QGridLayout;
- mainLayout->addWidget(rotableGroupBox, 0, 0);
+ mainLayout->addWidget(rotatableGroupBox, 0, 0);
mainLayout->addWidget(optionsGroupBox, 1, 0);
mainLayout->addWidget(buttonBox, 2, 0);
setLayout(mainLayout);
@@ -102,17 +102,17 @@ void Dialog::buttonsOrientationChanged(int index)
void Dialog::rotateWidgets()
{
- Q_ASSERT(rotableWidgets.count() % 2 == 0);
+ Q_ASSERT(rotatableWidgets.count() % 2 == 0);
- foreach (QWidget *widget, rotableWidgets)
- rotableLayout->removeWidget(widget);
+ foreach (QWidget *widget, rotatableWidgets)
+ rotatableLayout->removeWidget(widget);
- rotableWidgets.enqueue(rotableWidgets.dequeue());
+ rotatableWidgets.enqueue(rotatableWidgets.dequeue());
- const int n = rotableWidgets.count();
+ const int n = rotatableWidgets.count();
for (int i = 0; i < n / 2; ++i) {
- rotableLayout->addWidget(rotableWidgets[n - i - 1], 0, i);
- rotableLayout->addWidget(rotableWidgets[i], 1, i);
+ rotatableLayout->addWidget(rotatableWidgets[n - i - 1], 0, i);
+ rotatableLayout->addWidget(rotatableWidgets[i], 1, i);
}
}
@@ -123,23 +123,23 @@ void Dialog::help()
"dynamically."));
}
-void Dialog::createRotableGroupBox()
+void Dialog::createRotatableGroupBox()
{
- rotableGroupBox = new QGroupBox(tr("Rotable Widgets"));
+ rotatableGroupBox = new QGroupBox(tr("Rotatable Widgets"));
- rotableWidgets.enqueue(new QSpinBox);
- rotableWidgets.enqueue(new QSlider);
- rotableWidgets.enqueue(new QDial);
- rotableWidgets.enqueue(new QProgressBar);
+ rotatableWidgets.enqueue(new QSpinBox);
+ rotatableWidgets.enqueue(new QSlider);
+ rotatableWidgets.enqueue(new QDial);
+ rotatableWidgets.enqueue(new QProgressBar);
- int n = rotableWidgets.count();
+ int n = rotatableWidgets.count();
for (int i = 0; i < n; ++i) {
- connect(rotableWidgets[i], SIGNAL(valueChanged(int)),
- rotableWidgets[(i + 1) % n], SLOT(setValue(int)));
+ connect(rotatableWidgets[i], SIGNAL(valueChanged(int)),
+ rotatableWidgets[(i + 1) % n], SLOT(setValue(int)));
}
- rotableLayout = new QGridLayout;
- rotableGroupBox->setLayout(rotableLayout);
+ rotatableLayout = new QGridLayout;
+ rotatableGroupBox->setLayout(rotatableLayout);
rotateWidgets();
}
@@ -154,8 +154,10 @@ void Dialog::createOptionsGroupBox()
buttonsOrientationComboBox->addItem(tr("Horizontal"), Qt::Horizontal);
buttonsOrientationComboBox->addItem(tr("Vertical"), Qt::Vertical);
- connect(buttonsOrientationComboBox, SIGNAL(currentIndexChanged(int)),
- this, SLOT(buttonsOrientationChanged(int)));
+ connect(buttonsOrientationComboBox,
+ QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this,
+ &Dialog::buttonsOrientationChanged);
optionsLayout = new QGridLayout;
optionsLayout->addWidget(buttonsOrientationLabel, 0, 0);
@@ -173,7 +175,9 @@ void Dialog::createButtonBox()
rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),
QDialogButtonBox::ActionRole);
- connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
- connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
- connect(helpButton, SIGNAL(clicked()), this, SLOT(help()));
+ connect(rotateWidgetsButton, &QPushButton::clicked, this, &Dialog::rotateWidgets);
+ connect(closeButton, &QPushButton::clicked, this, &Dialog::close);
+ connect(helpButton, &QPushButton::clicked, this, &Dialog::help);
}
+
+