diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-06 22:38:45 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-17 23:05:23 +0200 |
commit | cb54c16584cf3be746a1a536c1e37cb3022a2f1b (patch) | |
tree | 712a4ee8d6383918233654e1deeefb3e91371941 /examples/widgets/widgets/calendarwidget | |
parent | 7db335a77e9efcfc8e0d4c1bd0834100403ec3b1 (diff) |
Cleanup QtWidgets (widgets) examples
Cleanup QtWidgets widgets examples:
- use member-init (clang-tidy)
- fix includes/don't include QtWidgets globally
- include own header first
- use nullptr (clang-tidy)
- avoid c-style casts
- use QVector instead QList
Change-Id: Ib56bb507eb2ef885f1ddc664050d3c7af92adb70
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/widgets/widgets/calendarwidget')
-rw-r--r-- | examples/widgets/widgets/calendarwidget/main.cpp | 2 | ||||
-rw-r--r-- | examples/widgets/widgets/calendarwidget/window.cpp | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/examples/widgets/widgets/calendarwidget/main.cpp b/examples/widgets/widgets/calendarwidget/main.cpp index 2622669f32..2582e83841 100644 --- a/examples/widgets/widgets/calendarwidget/main.cpp +++ b/examples/widgets/widgets/calendarwidget/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include <QtWidgets> +#include <QApplication> #include "window.h" diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp index 64047aaac9..b8a3d03552 100644 --- a/examples/widgets/widgets/calendarwidget/window.cpp +++ b/examples/widgets/widgets/calendarwidget/window.cpp @@ -48,10 +48,18 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "window.h" +#include <QCalendarWidget> +#include <QCheckBox> +#include <QComboBox> +#include <QDateEdit> +#include <QGridLayout> +#include <QGroupBox> +#include <QLabel> +#include <QLocale> +#include <QTextCharFormat> + //! [0] Window::Window(QWidget *parent) : QWidget(parent) @@ -166,13 +174,12 @@ void Window::reformatHeaders() QString text = headerTextFormatCombo->currentText(); QTextCharFormat format; - if (text == tr("Bold")) { + if (text == tr("Bold")) format.setFontWeight(QFont::Bold); - } else if (text == tr("Italic")) { + else if (text == tr("Italic")) format.setFontItalic(true); - } else if (text == tr("Green")) { + else if (text == tr("Green")) format.setForeground(Qt::green); - } calendar->setHeaderTextFormat(format); } //! [7] |