Update UI

This commit is contained in:
2026-08-20 13:27:31 +02:00
parent ecbd8bf8a9
commit cb41ac2aa2
40 changed files with 773 additions and 1436 deletions
+11 -24
View File
@@ -24,56 +24,43 @@ class UI_combobox : public UI_item
* @param selected The initially selected option
* @param parent The parent QObject
*/
UI_combobox(Color fg_color, Color bg_color, std::vector<std::string> options, size_t selected = 0,
UI_combobox(QList<QString> options, qsizetype selected = 0,
QObject *parent = nullptr);
void set_fg_color(Color fg_color);
Color fg_color() const;
void set_bg_color(Color bg_color);
Color bg_color() const;
/**
* @brief Set the selected option by index
*
* @param selected The index of the option to select
*/
void set_selected(size_t selected) override;
void set_selected(qsizetype selected) override;
/**
* @brief Set the selected option by text
*
* @param selected The text of the option to select
*/
void set_selected(std::string selected);
void set_selected(QString selected);
/**
* @brief Get the index of the selected option
*
* @return size_t The index of the selected option
*/
size_t selected() const;
qsizetype selected() const;
/**
* @brief Get the text of the selected option
*
* @return std::string The text of the selected option
*/
std::string selected_text() const &;
/**
* @brief Deserialize the combobox from JSON
*
* @param j The JSON object
*/
void from_json(const json &j) override;
/**
* @brief Serialize the combobox to JSON
*
* @param id The id of the combobox
* @return json The JSON representation of the combobox
*/
json to_json(size_t id) const override;
QString selected_text() const &;
signals:
/**
* @brief Signal emitted when the selected option changes
*
* @param selected The text of the newly selected option
*/
void changed(std::string selected);
private:
std::vector<std::string> m_options;
size_t m_selected;
void changed(QString selected);
};