shared_widget: Refactor again

Starting with combobox

Putting code specific to the sub-widget in their own function.
This commit is contained in:
lat9nq 2023-06-06 15:45:44 -04:00
parent 0f8a902d8c
commit 1d7fb41d59
2 changed files with 121 additions and 52 deletions

View file

@ -43,7 +43,7 @@ public:
const QString& string = QStringLiteral(""));
virtual ~Widget();
bool Valid();
bool Valid() const;
[[nodiscard]] static QPushButton* CreateRestoreGlobalButton(bool using_global, QWidget* parent);
@ -56,12 +56,16 @@ public:
QDateTimeEdit* date_time_edit{};
private:
void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed,
RequestType request, Settings::BasicSetting* other_setting);
QLabel* CreateLabel(const QString& text);
QHBoxLayout* CreateCheckBox(Settings::BasicSetting* bool_setting, const QString& label,
std::function<void()>& load_func, bool managed);
void CreateCombobox(const QString& label, std::function<void()>& load_func, bool managed,
Settings::BasicSetting* const other_setting = nullptr);
QWidget* CreateCombobox(std::function<std::string()>& serializer,
std::function<void()>& restore_func,
const std::function<void()>& touched);
void CreateLineEdit(const QString& label, std::function<void()>& load_func, bool managed,
Settings::BasicSetting* const other_setting = nullptr);
void CreateHexEdit(const QString& label, std::function<void()>& load_func, bool managed,