-
Notifications
You must be signed in to change notification settings - Fork 49
/
main.cpp
47 lines (36 loc) · 1.42 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <QApplication>
#include <QFormLayout>
#include <QVBoxLayout>
#include <ctkCheckablePushButton.h>
#include <ctkCollapsibleButton.h>
#include <ctkColorPickerButton.h>
#include <ctkRangeWidget.h>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// 可折叠按钮
ctkCollapsibleButton* buttons = new ctkCollapsibleButton("Buttons");
// 可勾选按钮
ctkCheckablePushButton* checkablePushButton = new ctkCheckablePushButton();
checkablePushButton->setText("Checkable");
// 颜色拾取器
ctkColorPickerButton* colorPickerButton = new ctkColorPickerButton();
colorPickerButton->setColor(QColor("#9e1414"));
ctkCollapsibleButton* sliders = new ctkCollapsibleButton("Sliders");
QFormLayout* buttonsLayout = new QFormLayout;
buttonsLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
buttonsLayout->addRow("ctkCheckablePushButton", checkablePushButton);
buttonsLayout->addRow("ctkColorPickerButton", colorPickerButton);
buttons->setLayout(buttonsLayout);
QVBoxLayout* topLevelLayout = new QVBoxLayout();
topLevelLayout->addWidget(buttons);
topLevelLayout->addWidget(sliders);
QFormLayout* slidersLayout = new QFormLayout;
ctkRangeWidget* rangeWidget = new ctkRangeWidget();
slidersLayout->addRow("ctkRangeWidget", rangeWidget);
sliders->setLayout(slidersLayout);
QWidget topLevel;
topLevel.setLayout(topLevelLayout);
topLevel.show();
return app.exec();
}