I am trying to develop an application in Wt, namely with the Dbo module and a QueryModel
to show in a WTableView
.
However, as I try to do this,
dbo::QueryModel< dbo::ptr<medical_staff> > *model = new dbo::QueryModel< dbo::ptr<medical_staff> >();
model->setQuery(session_.find<medical_staff>());
model->addAllFieldsAsColumns();
Wt::WTableView *view = new Wt::WTableView();
view->setModel(model);
In theory (I found a similar snipped on the web somewhere) this is good, but my compiler does not agree:
/home/phil/projects/TN-wt/src/view/StaffView.cxx:84:20: error: cannot convert ‘Wt::Dbo::QueryModel<Wt::Dbo::ptr<medical_staff> >*’ to ‘const std::shared_ptr<Wt::WAbstractItemModel>&’
84 | view->setModel(model);
| ^~~~~
| |
| Wt::Dbo::QueryModel<Wt::Dbo::ptr<medical_staff> >*
The error looks about the same as attic greek to me, could someone walk me through what is going on? Unfortunately there is no documentation for Dbo::QueryModel.
Further, is the Wt toolkit too old to use, unmaintained? Should I back away from using it now?
edit: I tried every type of std::make_shared(model) casting that would seem to make sense but then I get more attic greek:
/home/phil/projects/TN-wt/src/view/StaffView.cxx:82:27: error: no matching function for call to ‘make_shared(Wt::Dbo::QueryModel<Wt::Dbo::ptr<medical_staff> >*&)’
82 | std::make_shared(model);
| ^
In file included from /usr/include/c++/9/memory:81,
from /usr/include/Wt/Core/observable.hpp:12,
from /usr/include/Wt/Core/observing_ptr_impl.hpp:10,
from /usr/include/Wt/Core/observing_ptr.hpp:136,
from /usr/include/Wt/WGlobal.h:11,
from /usr/include/Wt/WObject.h:11,
from /usr/include/Wt/WWidget.h:10,
from /usr/include/Wt/WCompositeWidget.h:10,
from /home/phil/projects/TN-wt/src/view/StaffView.h:3,
from /home/phil/projects/TN-wt/src/view/StaffView.cxx:1:
/usr/include/c++/9/bits/shared_ptr.h:714:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’
714 | make_shared(_Args&&... __args)
| ^~~~~~~~~~~
/usr/include/c++/9/bits/shared_ptr.h:714:5: note: template argument deduction/substitution failed:
/home/phil/projects/TN-wt/src/view/StaffView.cxx:82:27: note: couldn’t deduce template parameter ‘_Tp’
82 | std::make_shared(model);
| ^