|
namespace
|
|
{
|
|
class ItemDelegate
|
|
: public Wt::WItemDelegate
|
|
{
|
|
public:
|
|
ItemDelegate()
|
|
: Wt::WItemDelegate()
|
|
{}
|
|
virtual Wt::WWidget *update( Wt::WWidget *widget, const Wt::WModelIndex& index, Wt::WFlags< Wt::ViewItemRenderFlag > flags ) override
|
|
{
|
|
auto w = Wt::WItemDelegate::update( widget, index, flags );
|
|
if( auto interactWidget = dynamic_cast< Wt::WInteractWidget* >( w ) )
|
|
interactWidget->mouseWentUp().connect( [](...){ Wt::WMessageBox::show( "Ok", "signal mouseWentUp fired", Wt::Ok ); } );
|
|
return w;
|
|
}
|
|
};
|
|
class TestEmptyHeaderClicked
|
|
: public Wt::WApplication
|
|
{
|
|
public:
|
|
TestEmptyHeaderClicked( const Wt::WEnvironment& env )
|
|
: Wt::WApplication( env )
|
|
{
|
|
auto tableView = new Wt::WTableView();
|
|
auto model = new Wt::WStandardItemModel();
|
|
tableView->setModel( model );
|
|
tableView->setHeaderItemDelegate( new ItemDelegate() );
|
|
model->appendRow
|
|
({ new Wt::WStandardItem( "std::string( \"Header\" )" )
|
|
, new Wt::WStandardItem( "std::string( \"X\" )" )
|
|
, new Wt::WStandardItem( "std::string( \" \" )" )
|
|
, new Wt::WStandardItem( "std::string( \"\" )" )
|
|
});
|
|
model->setHeaderData( 0, boost::any( std::string( "Header" ) ) );
|
|
model->setHeaderData( 1, boost::any( std::string( "X" ) ) );
|
|
model->setHeaderData( 2, boost::any( std::string( " " ) ) );
|
|
model->setHeaderData( 3, boost::any( std::string( "" ) ) );
|
|
root()->addWidget( tableView );
|
|
}
|
|
};
|
|
}
|