Thu, 20 Apr 2023 17:23:44 +0200
Fixed recipe editor add yeast crash.
20
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
94
380b1331ad2e
More progress in building designer plugins.
Michiel Broek <mbroek@mbse.eu>
parents:
20
diff
changeset
|
2 | * NullDateEdit.cpp is part of bmsapp. |
20
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * See https://www.qtcentre.org/threads/17295-How-to-put-empty-value-in-QDateEdit |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * bmsapp is free software: you can redistribute it and/or modify |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * it under the terms of the GNU General Public License as published by |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * the Free Software Foundation, either version 3 of the License, or |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * (at your option) any later version. |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * bmsapp is distributed in the hope that it will be useful, |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * GNU General Public License for more details. |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | */ |
94
380b1331ad2e
More progress in building designer plugins.
Michiel Broek <mbroek@mbse.eu>
parents:
20
diff
changeset
|
19 | #include "NullDateEdit.h" |
20
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | NullDateEdit::NullDateEdit(const QDate& date, QWidget* parent) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | : QDateEdit(date, parent) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | this->setSpecialValueText("Null"); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | } |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | NullDateEdit::NullDateEdit(QWidget* parent) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | : QDateEdit(parent) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | this->setSpecialValueText("Null"); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | } |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | NullDateEdit::~NullDateEdit() |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | } |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | void NullDateEdit::clear() |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | this->setDate(this->minimumDate()); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | } |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | QDate NullDateEdit::nullDate() const |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | if (date() == this->minimumDate()) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | return QDate(); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | return date(); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | } |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | void NullDateEdit::setDate(const QDate & date) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | if (date.isNull()) |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | QDateEdit::setDate(this->minimumDate()); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | QDateEdit::setDate(date); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | } |