Changeset View
Changeset View
Standalone View
Standalone View
tests/windowdecotest.cpp
Show All 20 Lines | |||||
21 | * after a window is hidden and shown. | 21 | * after a window is hidden and shown. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include <QApplication> | 24 | #include <QApplication> | ||
25 | #include <QWidget> | 25 | #include <QWidget> | ||
26 | #include <QPushButton> | 26 | #include <QPushButton> | ||
27 | #include <QVBoxLayout> | 27 | #include <QVBoxLayout> | ||
28 | #include <QTimer> | 28 | #include <QTimer> | ||
29 | #include <KColorSchemeManager> | ||||
30 | #include <KActionMenu> | ||||
31 | #include <QComboBox> | ||||
32 | #include <QToolButton> | ||||
33 | #include <QDebug> | ||||
34 | | ||||
29 | 35 | | |||
30 | class ATestWindow: public QWidget | 36 | class ATestWindow: public QWidget | ||
31 | { | 37 | { | ||
32 | Q_OBJECT | 38 | Q_OBJECT | ||
33 | public: | 39 | public: | ||
34 | ATestWindow(); | 40 | ATestWindow(); | ||
35 | 41 | | |||
36 | private: | 42 | private: | ||
37 | QPushButton *mBtn; | 43 | QPushButton *mBtn; | ||
38 | QWidget *m_area; | 44 | QWidget *m_area; | ||
39 | }; | 45 | }; | ||
40 | 46 | | |||
41 | ATestWindow::ATestWindow() | 47 | ATestWindow::ATestWindow() | ||
42 | { | 48 | { | ||
43 | mBtn = new QPushButton(QStringLiteral("Hide and Show")); | 49 | mBtn = new QPushButton(QStringLiteral("Hide and Show")); | ||
44 | 50 | | |||
45 | m_area = new QWidget; | 51 | m_area = new QWidget; | ||
46 | m_area->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 52 | m_area->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
47 | 53 | | |||
48 | connect(mBtn, &QPushButton::clicked, this, [this]() { | 54 | connect(mBtn, &QPushButton::clicked, this, [this]() { | ||
49 | this->hide(); | 55 | this->hide(); | ||
50 | QTimer::singleShot(1000, this, [this](){this->show();}); | 56 | QTimer::singleShot(1000, this, [this](){this->show();}); | ||
51 | }); | 57 | }); | ||
52 | 58 | | |||
59 | QComboBox *colorCombo = new QComboBox(); | ||||
60 | KColorSchemeManager *schemes = new KColorSchemeManager(this); | ||||
61 | colorCombo->setModel(schemes->model()); | ||||
62 | | ||||
63 | connect(colorCombo, QOverload<int>::of(&QComboBox::activated), schemes, [=](int row) { | ||||
64 | schemes->activateScheme(colorCombo->model()->index(row, 0)); | ||||
65 | }); | ||||
66 | | ||||
53 | QVBoxLayout *layout = new QVBoxLayout; | 67 | QVBoxLayout *layout = new QVBoxLayout; | ||
54 | layout->addWidget(mBtn); | 68 | layout->addWidget(mBtn); | ||
69 | layout->addWidget(colorCombo); | ||||
55 | setLayout(layout); | 70 | setLayout(layout); | ||
56 | } | 71 | } | ||
57 | 72 | | |||
58 | 73 | | |||
59 | 74 | | |||
60 | int main(int argc, char **argv) | 75 | int main(int argc, char **argv) | ||
61 | { | 76 | { | ||
62 | QApplication app(argc, argv); | 77 | QApplication app(argc, argv); | ||
Show All 9 Lines |