Thu, 21 Mar 2013 12:57:06 +0200
Scroll the color picker dialog to the selected color if it's off-screen
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri `arezey` Piippo |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include <qdialog.h> |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <qdialogbuttonbox.h> |
49
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
21 | #include <qgraphicsscene.h> |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
22 | #include <qlabel.h> |
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | class ColorSelectDialog : public QDialog { |
49
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
25 | Q_OBJECT |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
26 | |
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | public: |
49
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
28 | explicit ColorSelectDialog (short dDefault = -1, QWidget* parent = nullptr); |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
29 | static bool staticDialog (short& dValue, short dDefault = -1, QWidget* parent = nullptr); |
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | QGraphicsScene* qScene; |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | QGraphicsView* qView; |
49
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
33 | QLabel* qColorInfo; |
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | QDialogButtonBox* qButtons; |
49
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
35 | short dSelColor; |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
36 | |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
37 | private: |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
38 | void drawScene (); |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
39 | void drawColorInfo (); |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
40 | |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
41 | private slots: |
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
42 | void mousePressEvent (QMouseEvent* event); |
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | }; |