mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:38:12 +00:00
LibGUI: Allow specifying the model column for GListView and GComboBox
These widgets can only display a single column from the underlying data model, and it was previously hard-coded to use column 0. Now you can use any column you like.
This commit is contained in:
parent
7c0f9ea2b9
commit
ffff150435
2 changed files with 6 additions and 0 deletions
|
@ -26,6 +26,9 @@ public:
|
|||
bool only_allow_values_from_model() const { return m_only_allow_values_from_model; }
|
||||
void set_only_allow_values_from_model(bool);
|
||||
|
||||
int model_column() const { return m_list_view->model_column(); }
|
||||
void set_model_column(int column) { m_list_view->set_model_column(column); }
|
||||
|
||||
Function<void(const String&)> on_change;
|
||||
Function<void()> on_return_pressed;
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ public:
|
|||
|
||||
virtual Rect content_rect(const GModelIndex&) const override;
|
||||
|
||||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
||||
private:
|
||||
virtual void did_update_model() override;
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue