TableView Model
Added by Samuele Pederzini over 3 years ago
Hi,
I have a problem with tableView
this is error:
hello.C:159:46: error: no matching function for call to ‘Wt::WTableView::setModel(std::remove_reference<Wt::Dbo::QueryModel<std::tuple<Wt::Dbo::ptr<Utente>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*&>::type)’
tableView->setModel(std::move(modelDataTable));
^
In file included from hello.C:30:0:
/usr/local/include/Wt/WTableView.h:94:16: note: candidate: virtual void Wt::WTableView::setModel(const std::shared_ptr<Wt::WAbstractItemModel>&)
virtual void setModel(const std::shared_ptr<WAbstractItemModel>& model)
^
/usr/local/include/Wt/WTableView.h:94:16: note: no known conversion for argument 1 from ‘std::remove_reference<Wt::Dbo::QueryModel<std::tuple<Wt::Dbo::ptr<Utente>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*&>::type {aka Wt::Dbo::QueryModel<std::tuple<Wt::Dbo::ptr<Utente>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*}’ to ‘const std::shared_ptr<Wt::WAbstractItemModel>&’
And this is mycode
typedef std::tuple<Wt::Dbo::ptr<Utente>, int, std::string> Item;
Wt::Dbo::QueryModel<Item> *modelDataTable = new Wt::Dbo::QueryModel<Item>();
modelDataTable->setQuery(session.query<Item>("select Utente, (Select 2) as pippo, utente.cognome as cg from utente Utente GROUP BY utente.cognome"));
modelDataTable->addAllFieldsAsColumns();
Wt::WTableView * tableView = this->root()->addWidget(std::make_unique<Wt::WTableView>() );
tableView->setModel(std::move(modelDataTable));
Thanks so much