Introduce old redir program
[lcapit-junk-code.git] / qt-course / qt-designer / MyWidget.cpp
blob78e53d937de284a1412ec3b4fc82f789d8f64a17
1 #include <QDate>
3 #include "MyWidget.h"
5 MyWidget::MyWidget(QWidget *parent)
6 : QWidget(parent)
8 m_ui = new Ui::MyWidgetBase();
9 m_ui->setupUi(this);
11 m_ui->m_hslider->setMinimum(1);
12 m_ui->m_progress->setMinimum(1);
14 connect(m_ui->m_calendar, SIGNAL(clicked(const QDate &)), this,
15 SLOT(slot_clicked(const QDate &)));
16 connect(m_ui->m_hslider, SIGNAL(valueChanged(int)), this,
17 SLOT(slot_changed(int)));
19 slot_clicked(QDate::currentDate());
22 MyWidget::~MyWidget()
26 void MyWidget::slot_clicked(const QDate &date)
28 // slider
29 m_ui->m_hslider->setMaximum(date.daysInMonth());
30 m_ui->m_hslider->setValue(date.day());
32 // progress bar
33 m_ui->m_progress->setMaximum(date.daysInMonth());
34 m_ui->m_progress->setValue(date.day());
36 // label
37 m_ui->m_label->setText(date.toString("dddd"));
40 void MyWidget::slot_changed(int value)
42 QDate date;
44 date = QDate::currentDate();
46 date.setDate(date.year(), date.month(), value);
47 m_ui->m_calendar->setSelectedDate(date);
48 slot_clicked(date);