mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 14:11:12 +01:00
Update UI
This commit is contained in:
+17
-39
@@ -24,41 +24,41 @@ class UI_table : public UI_item
|
||||
* @param column_labels The labels for the columns
|
||||
* @param parent The parent QObject
|
||||
*/
|
||||
explicit UI_table(size_t row_count, size_t column_count, std::vector<std::string> row_labels,
|
||||
std::vector<std::string> column_labels, QObject *parent = nullptr);
|
||||
explicit UI_table(qsizetype row_count, qsizetype column_count, QList<QString> row_labels,
|
||||
QList<QString> column_labels, QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Set the number of rows in the table
|
||||
*
|
||||
* @param count The number of rows
|
||||
*/
|
||||
void set_row_count(size_t count);
|
||||
void set_row_count(qsizetype count);
|
||||
/**
|
||||
* @brief Get the number of rows in the table
|
||||
*
|
||||
* @return size_t The number of rows
|
||||
*/
|
||||
size_t row_count() const;
|
||||
qsizetype row_count() const;
|
||||
|
||||
/**
|
||||
* @brief Set the number of columns in the table
|
||||
*
|
||||
* @param count The number of columns
|
||||
*/
|
||||
void set_column_count(size_t count);
|
||||
void set_column_count(qsizetype count);
|
||||
/**
|
||||
* @brief Get the number of columns in the table
|
||||
*
|
||||
* @return size_t The number of columns
|
||||
*/
|
||||
size_t column_count() const;
|
||||
qsizetype column_count() const;
|
||||
|
||||
/**
|
||||
* @brief Get the capacity of the table (rows * columns)
|
||||
*
|
||||
* @return size_t The capacity of the table
|
||||
*/
|
||||
size_t capacity() const;
|
||||
qsizetype capacity() const;
|
||||
|
||||
/**
|
||||
* @brief Set the label for a specific row
|
||||
@@ -66,14 +66,14 @@ class UI_table : public UI_item
|
||||
* @param index The index of the row
|
||||
* @param label The label to set
|
||||
*/
|
||||
void set_row_label(size_t index, std::string label);
|
||||
void set_row_label(qsizetype index, QString label);
|
||||
/**
|
||||
* @brief Get the label of a specific row
|
||||
*
|
||||
* @param index The index of the row
|
||||
* @return std::string The label of the row
|
||||
* @return QString The label of the row
|
||||
*/
|
||||
std::string row_label(size_t index) const;
|
||||
QString row_label(qsizetype index) const;
|
||||
|
||||
/**
|
||||
* @brief Set the label for a specific column
|
||||
@@ -81,14 +81,14 @@ class UI_table : public UI_item
|
||||
* @param index The index of the column
|
||||
* @param label The label to set
|
||||
*/
|
||||
void set_column_label(size_t index, std::string label);
|
||||
void set_column_label(qsizetype index, QString label);
|
||||
/**
|
||||
* @brief Get the label of a specific column
|
||||
*
|
||||
* @param index The index of the column
|
||||
* @return std::string The label of the column
|
||||
* @return QString The label of the column
|
||||
*/
|
||||
std::string column_label(size_t index) const &;
|
||||
QString column_label(qsizetype index) const &;
|
||||
|
||||
/**
|
||||
* @brief Insert an item into the table at the specified row and column
|
||||
@@ -97,42 +97,20 @@ class UI_table : public UI_item
|
||||
* @param column The column of the item
|
||||
* @param text The text of the item
|
||||
*/
|
||||
void insert_item(size_t row, size_t column, std::string text);
|
||||
void insert_item(qsizetype row, qsizetype column, QString text);
|
||||
/**
|
||||
* @brief Get the item at the specified row and column
|
||||
*
|
||||
* @param row The row of the item
|
||||
* @param column The column of the item
|
||||
* @return std::string The text of the item
|
||||
* @return QString The text of the item
|
||||
*/
|
||||
std::string item(size_t row, size_t column) const &;
|
||||
QString item(qsizetype row, qsizetype column) const &;
|
||||
|
||||
/**
|
||||
* @brief empty_item This function clears the item
|
||||
* @param row The row of the item
|
||||
* @param column The column of the item
|
||||
*/
|
||||
void empty_item(size_t row, size_t column);
|
||||
|
||||
/**
|
||||
* @brief Deserialize the table from JSON
|
||||
*
|
||||
* @param j The JSON object
|
||||
*/
|
||||
void from_json(const json &j) override;
|
||||
/**
|
||||
* @brief Serialize the table to JSON
|
||||
*
|
||||
* @param id The id of the table
|
||||
* @return json The JSON representation of the table
|
||||
*/
|
||||
json to_json(size_t id) const override;
|
||||
|
||||
private:
|
||||
size_t m_row_count;
|
||||
size_t m_column_count;
|
||||
std::vector<std::string> m_row_labels;
|
||||
std::vector<std::string> m_column_labels;
|
||||
|
||||
std::vector<std::string> m_table;
|
||||
void empty_item(qsizetype row, qsizetype column);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user