comparison src/gui/widgets/optional_date.cpp @ 63:3d2decf093bb

*: fix many clang warnings
author Paper <mrpapersonic@gmail.com>
date Sun, 01 Oct 2023 06:39:47 -0400
parents 4c6dd5999b39
children
comparison
equal deleted inserted replaced
62:4c6dd5999b39 63:3d2decf093bb
27 SetEnabled(enabled); 27 SetEnabled(enabled);
28 connect(_checkbox, &QCheckBox::stateChanged, this, [this](int state) { 28 connect(_checkbox, &QCheckBox::stateChanged, this, [this](int state) {
29 SetEnabled(state == Qt::Checked); 29 SetEnabled(state == Qt::Checked);
30 emit DataChanged(IsEnabled(), GetDate()); 30 emit DataChanged(IsEnabled(), GetDate());
31 }); 31 });
32 connect(_dateedit, &QDateEdit::dateChanged, this, [this](QDate) { 32 connect(_dateedit, &QDateEdit::dateChanged, this, [this](QDate) { emit DataChanged(IsEnabled(), GetDate()); });
33 emit DataChanged(IsEnabled(), GetDate());
34 });
35 } 33 }
36 34
37 void OptionalDate::SetEnabled(bool enabled) { 35 void OptionalDate::SetEnabled(bool enabled) {
38 _checkbox->setCheckState(enabled ? Qt::Checked : Qt::Unchecked); 36 _checkbox->setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
39 _dateedit->setEnabled(enabled); 37 _dateedit->setEnabled(enabled);
46 void OptionalDate::SetDate(QDate date) { 44 void OptionalDate::SetDate(QDate date) {
47 _dateedit->setDate(date); 45 _dateedit->setDate(date);
48 } 46 }
49 47
50 void OptionalDate::SetDate(Date date) { 48 void OptionalDate::SetDate(Date date) {
51 if (!date.IsValid()) return; 49 if (!date.IsValid())
50 return;
52 SetDate(date.GetAsQDate()); 51 SetDate(date.GetAsQDate());
53 } 52 }
54 53
55 Date OptionalDate::GetDate() { 54 Date OptionalDate::GetDate() {
56 return Date(_dateedit->date()); 55 return Date(_dateedit->date());