src/widgets/colorselectdialog.h

changeset 95
06a1aef170aa
child 112
5760cbb32bc0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/colorselectdialog.h	Thu Nov 05 14:29:58 2020 +0200
@@ -0,0 +1,30 @@
+#pragma once
+#include "../main.h"
+#include "../colors.h"
+#include <QPushButton>
+#include <QAbstractTableModel>
+#include <QDialog>
+#include <QGridLayout>
+
+class ColorSelectDialog : public QDialog
+{
+	Q_OBJECT
+public:
+	explicit ColorSelectDialog(const ldraw::ColorTable& colorTable, QWidget* parent = nullptr);
+	~ColorSelectDialog();
+	void setCurrentColor(ldraw::Color color);
+	ldraw::Color currentColor() const;
+private slots:
+	void populateColors();
+	void updateSelectedColorTexts();
+	void handleButtonClick();
+	void spinboxEdited();
+	void chooseDirectColor();
+private:
+	void makeColorButtons();
+	bool filterColor(ldraw::Color color) const;
+	class Ui_ColorSelectDialog& ui;
+	const ldraw::ColorTable& colorTable;
+	std::vector<QPushButton*> buttons;
+	ldraw::Color selectedColor = ldraw::mainColor;
+};

mercurial