Debian Codegraph @

kysdk-qtwidgets/test/testLunarDateEdit/widget.cpp

raw
1 #include "widget.h"
2 #include "klunardateedit.h"
3 #include <QVBoxLayout>
4
5 Widget::Widget(QWidget *parent)
6 : QWidget(parent)
7 {
8 this->setFixedSize(300, 150);
9 QVBoxLayout *layout = new QVBoxLayout(this);
10
11 m_pLunarCheckBox = new QCheckBox(this);
12 m_pLunarCheckBox->setObjectName(QString::fromUtf8("checkBox"));
13 m_pLunarCheckBox->setGeometry(QRect(120, 80, 82, 21));
14 m_pLunarCheckBox->setChecked(false);
15 m_pLunarCheckBox->setText("Lunar");
16
17 m_pLunarDateEdit = new KLunarDateEdit(this);
18 m_pLunarDateEdit->setFixedSize(140, 36);
19
20 layout->addWidget(m_pLunarCheckBox);
21 layout->addWidget(m_pLunarDateEdit);
22
23 // 用法,拿到DateEdit指针,然后像正常DateEdit控件一样用,农历会跟随刷新
24 m_pLunarDateEdit->getDateEdit()->setDate(QDate::currentDate());
25
26 QMetaObject::connectSlotsByName(this);
27 }
28
29 Widget::~Widget()
30 {
31 }
32
33 void Widget::on_checkBox_clicked(bool checked)
34 {
35 m_pLunarDateEdit->setShowLunar(checked);
36 }