Sun, 09 Apr 2023 15:59:08 +0300
Extracted the state of the program into a MainState structure, and extracted local functions of main() into static functions.
I was planning to make the core logic and state of the program into a Main class, which would be a QObject that would
have lots of signals and slots, but it looks like this works even without it
#pragma once #include <QPushButton> #include <QLineEdit> /** * @brief A button that can be used to select a color */ class ColorEdit : public QWidget { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) QLineEdit* lineEdit; QPushButton* button; public: ColorEdit(const QColor& color = {}, QWidget* parent = nullptr); ColorEdit(QWidget* parent = nullptr); QColor color() const; Q_SLOT void setColor(const QColor& color); Q_SIGNAL void colorChanged(const QColor& color); };