src/widgets/doublespinbox.h

Tue, 19 Jun 2018 21:49:21 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 19 Jun 2018 21:49:21 +0300
changeset 1408
0d6162662040
parent 1387
6393b6020c62
permissions
-rw-r--r--

fixed bugs regarding primitives, added chord substitution

1387
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 /*
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 *
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 * (at your option) any later version.
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 *
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * GNU General Public License for more details.
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 *
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 */
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #pragma once
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include <QDoubleSpinBox>
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 /*
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 * A version of QDoubleSpinBox that consistently uses "." as the decimal separator
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 * and does not display trailing zeros.
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 */
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 class DoubleSpinBox : public QDoubleSpinBox
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 {
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 public:
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 DoubleSpinBox(QWidget* parent = nullptr);
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 protected:
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 QString textFromValue(double value) const override;
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 QValidator::State validate(QString& input, int& pos) const override;
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 };
6393b6020c62 added a doublespinbox variant that uses "." as the decimal point and omits trailing zeros
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35

mercurial