Update UI

This commit is contained in:
2026-09-30 12:33:20 +02:00
parent 4618c500c9
commit 022422b63c
40 changed files with 773 additions and 1436 deletions
+8 -27
View File
@@ -21,20 +21,20 @@ class UI_tab_widget : public UI_item
* @param selected The initially selected tab
* @param parent The parent QObject
*/
UI_tab_widget(std::vector<std::string> tab_names, size_t selected = 0, QObject *parent = nullptr);
UI_tab_widget(QList<QString> tab_names, qsizetype selected = 0, QObject *parent = nullptr);
/**
* @brief Set the selected tab by index
*
* @param selected The index of the tab to select
*/
void set_selected(size_t selected) override;
void set_selected(qsizetype selected) override;
/**
* @brief Get the index of the selected tab
*
* @return size_t The index of the selected tab
*/
size_t selected() const;
qsizetype selected() const;
/**
* @brief Set the visibility of a tab by index
@@ -42,7 +42,7 @@ class UI_tab_widget : public UI_item
* @param index The index of the tab
* @param visible True to show, false to hide
*/
void set_visible(size_t index, bool visible);
void set_visible(qsizetype index, bool visible);
/**
* @brief Get the visibility of a tab by index
*
@@ -50,7 +50,7 @@ class UI_tab_widget : public UI_item
* @return true If the tab is visible
* @return false If the tab is hidden
*/
bool visible(size_t index) const;
bool visible(qsizetype index) const;
/**
* @brief Set the name of a tab by index
@@ -58,44 +58,25 @@ class UI_tab_widget : public UI_item
* @param index The index of the tab
* @param name The name to set
*/
void set_tab_name(size_t index, std::string name);
void set_tab_name(qsizetype index, QString name);
/**
* @brief Get the name of a tab by index
*
* @param index The index of the tab
* @return std::string The name of the tab
*/
std::string tab_name(size_t index) const;
QString tab_name(qsizetype index) const;
/**
* @brief Advance to the next tab
*
*/
void advance_tab();
/**
* @brief Deserialize the tab widget from JSON
*
* @param j The JSON object
*/
void from_json(const json &j) override;
/**
* @brief Serialize the tab widget to JSON
*
* @param id The id of the tab widget
* @return json The JSON representation of the tab widget
*/
json to_json(size_t id) const override;
signals:
/**
* @brief Signal emitted when the selected tab changes
*
* @param index The index of the newly selected tab
*/
void changed(size_t index);
private:
size_t m_selected_tab;
std::vector<std::string> m_tab_names;
std::vector<bool> m_tab_visible;
void changed(qsizetype index);
};