#include #include #include #include namespace { class TestTreeView : public Wt::WApplication { public: TestTreeView( const Wt::WEnvironment& env ) : Wt::WApplication( env ) { Wt::WTreeView* treeView = new Wt::WTreeView( root() ); Wt::WStandardItemModel* model = new Wt::WStandardItemModel( 0, 1, treeView ); model->setHeaderData( 0, Wt::Horizontal, std::string( "Click here reconnects events every time" ) ); std::vector< Wt::WStandardItem* > items; items.push_back( new Wt::WStandardItem( "Click to test how often the mouse events fire" ) ); model->appendRow( items ); treeView->setModel( model ); treeView->clicked().connect ( []( auto model, ... ) { static int count = 0; std::cout << "clicked " << count++ << " - Valid = " << model.isValid() << std::endl; }); } }; }