The model for dropdown should has no selection
This commit is contained in:
parent
a1801762c0
commit
42dc2a0fc6
|
@ -22,7 +22,9 @@ MainWin::MainWin()
|
||||||
|
|
||||||
// Create List for column View
|
// Create List for column View
|
||||||
main_list = Gio::ListStore<ModelColumns>::create();
|
main_list = Gio::ListStore<ModelColumns>::create();
|
||||||
selection = Gtk::SingleSelection::create(main_list);
|
|
||||||
|
// The list for dropdown to select should has no selection
|
||||||
|
selection = Gtk::NoSelection::create(main_list);
|
||||||
main_column_view.set_model(selection);
|
main_column_view.set_model(selection);
|
||||||
|
|
||||||
// Add items
|
// Add items
|
||||||
|
@ -162,13 +164,13 @@ void MainWin::bind_version(const Glib::RefPtr<Gtk::ListItem> &item)
|
||||||
void MainWin::btnadd_clicked()
|
void MainWin::btnadd_clicked()
|
||||||
{
|
{
|
||||||
// Append a item to the list
|
// Append a item to the list
|
||||||
main_list->append(ModelColumns::create(" ", " "));
|
main_list->append(ModelColumns::create("", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWin::btnremove_clicked()
|
void MainWin::btnremove_clicked()
|
||||||
{
|
{
|
||||||
// Get Position of item
|
// Get Position of item
|
||||||
auto pos = selection->get_selected();
|
auto pos = main_list->get_n_items() - 1;
|
||||||
|
|
||||||
// Remove item
|
// Remove item
|
||||||
main_list->remove(pos);
|
main_list->remove(pos);
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
private:
|
private:
|
||||||
// Main list object for branchs and versions
|
// Main list object for branchs and versions
|
||||||
Glib::RefPtr<Gio::ListStore<ModelColumns>> main_list;
|
Glib::RefPtr<Gio::ListStore<ModelColumns>> main_list;
|
||||||
Glib::RefPtr<Gtk::SingleSelection> selection;
|
Glib::RefPtr<Gtk::NoSelection> selection;
|
||||||
|
|
||||||
// Factory to renderer string for dropdown
|
// Factory to renderer string for dropdown
|
||||||
Glib::RefPtr<Gtk::SignalListItemFactory> drop_factory;
|
Glib::RefPtr<Gtk::SignalListItemFactory> drop_factory;
|
||||||
|
|
Loading…
Reference in New Issue