widgets/doublespinbox.h

Fri, 01 Jul 2022 16:46:43 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Fri, 01 Jul 2022 16:46:43 +0300
changeset 312
2637134bc37c
parent 253
8b994c917f69
permissions
-rw-r--r--

Fix right click to delete not really working properly
Instead of removing the point that had been added, it would remove
the point that is being drawn, which would cause it to overwrite the
previous point using the new point, causing a bit of a delay

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

mercurial