summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/calendarwidget
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-12-02 14:16:47 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-26 10:37:06 +0000
commitbf4bf3a58360d4f7907895096b452cb3821ea593 (patch)
tree0a784f40986afb9c73aed2f5d13a2f554a09ce2e /examples/widgets/widgets/calendarwidget
parente81acde7d0cf5fb44a3fb2cf0bf7aaa2c65f807e (diff)
Cleanup Widgets examples - signals/slots
Cleanup the widgets examples - use new signal/slot syntax where possible Change-Id: I6bc8953534d8b1efca0de4ee6a9fe4a6aa79fda9 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/widgets/calendarwidget')
-rw-r--r--examples/widgets/widgets/calendarwidget/window.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp
index a1c1746786..64047aaac9 100644
--- a/examples/widgets/widgets/calendarwidget/window.cpp
+++ b/examples/widgets/widgets/calendarwidget/window.cpp
@@ -221,8 +221,8 @@ void Window::createPreviewGroupBox()
calendar->setMaximumDate(QDate(3000, 1, 1));
calendar->setGridVisible(true);
- connect(calendar, SIGNAL(currentPageChanged(int,int)),
- this, SLOT(reformatCalendarPage()));
+ connect(calendar, &QCalendarWidget::currentPageChanged,
+ this, &Window::reformatCalendarPage);
previewLayout = new QGridLayout;
previewLayout->addWidget(calendar, 0, 0, Qt::AlignCenter);
@@ -306,20 +306,20 @@ void Window::createGeneralOptionsGroupBox()
verticalHeaderLabel->setBuddy(verticalHeaderCombo);
//! [11]
- connect(localeCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(localeChanged(int)));
- connect(firstDayCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(firstDayChanged(int)));
- connect(selectionModeCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(selectionModeChanged(int)));
- connect(gridCheckBox, SIGNAL(toggled(bool)),
- calendar, SLOT(setGridVisible(bool)));
- connect(navigationCheckBox, SIGNAL(toggled(bool)),
- calendar, SLOT(setNavigationBarVisible(bool)));
- connect(horizontalHeaderCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(horizontalHeaderChanged(int)));
- connect(verticalHeaderCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(verticalHeaderChanged(int)));
+ connect(localeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::localeChanged);
+ connect(firstDayCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::firstDayChanged);
+ connect(selectionModeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::selectionModeChanged);
+ connect(gridCheckBox, &QCheckBox::toggled,
+ calendar, &QCalendarWidget::setGridVisible);
+ connect(navigationCheckBox, &QCheckBox::toggled,
+ calendar, &QCalendarWidget::setNavigationBarVisible);
+ connect(horizontalHeaderCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::horizontalHeaderChanged);
+ connect(verticalHeaderCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::verticalHeaderChanged);
//! [11]
QHBoxLayout *checkBoxLayout = new QHBoxLayout;
@@ -382,14 +382,14 @@ void Window::createDatesGroupBox()
maximumDateLabel->setBuddy(maximumDateEdit);
//! [13] //! [14]
- connect(currentDateEdit, SIGNAL(dateChanged(QDate)),
- calendar, SLOT(setSelectedDate(QDate)));
- connect(calendar, SIGNAL(selectionChanged()),
- this, SLOT(selectedDateChanged()));
- connect(minimumDateEdit, SIGNAL(dateChanged(QDate)),
- this, SLOT(minimumDateChanged(QDate)));
- connect(maximumDateEdit, SIGNAL(dateChanged(QDate)),
- this, SLOT(maximumDateChanged(QDate)));
+ connect(currentDateEdit, &QDateEdit::dateChanged,
+ calendar, &QCalendarWidget::setSelectedDate);
+ connect(calendar, &QCalendarWidget::selectionChanged,
+ this, &Window::selectedDateChanged);
+ connect(minimumDateEdit, &QDateEdit::dateChanged,
+ this, &Window::minimumDateChanged);
+ connect(maximumDateEdit, &QDateEdit::dateChanged,
+ this, &Window::maximumDateChanged);
//! [14]
QGridLayout *dateBoxLayout = new QGridLayout;
@@ -439,20 +439,20 @@ void Window::createTextFormatsGroupBox()
mayFirstCheckBox = new QCheckBox(tr("May &1 in red"));
//! [17] //! [18]
- connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(weekdayFormatChanged()));
- connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(reformatCalendarPage()));
- connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(weekendFormatChanged()));
- connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(reformatCalendarPage()));
- connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(reformatHeaders()));
- connect(firstFridayCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(reformatCalendarPage()));
- connect(mayFirstCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(reformatCalendarPage()));
+ connect(weekdayColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::weekdayFormatChanged);
+ connect(weekdayColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::reformatCalendarPage);
+ connect(weekendColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::weekendFormatChanged);
+ connect(weekendColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::reformatCalendarPage);
+ connect(headerTextFormatCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &Window::reformatHeaders);
+ connect(firstFridayCheckBox, &QCheckBox::toggled,
+ this, &Window::reformatCalendarPage);
+ connect(mayFirstCheckBox, &QCheckBox::toggled,
+ this, &Window::reformatCalendarPage);
//! [18]
QHBoxLayout *checkBoxLayout = new QHBoxLayout;