Project

General

Profile

Support #1207 ยป test.cpp

Max Quatember, 01/30/2013 08:58 AM

 
#include <Wt/WTableView>
#include <Wt/WTreeView>

namespace
{
class TestPopupEmptyTreeView
: public Wt::WApplication
{
public:
TestPopupEmptyTreeView( const Wt::WEnvironment& env )
: Wt::WApplication( env )
{
root()->setAttributeValue( "oncontextmenu", "event.cancelBubble = true; event.returnValue = false; return false;" );

auto c = new Wt::WContainerWidget( root() );
c->resize( 1000, 1000 );

//auto table = new Wt::WTreeView( c );
auto table = new Wt::WTableView( c );
table->mouseWentUp().connect( SLOT( this, TestPopupEmptyTreeView::OnMouseWentUp ) );
table->resize( 900, 900 );
auto model = new Wt::WStandardItemModel( 0, 2 );
model->setHeaderData( 0, boost::any( std::string( "1" ) ) );
model->setHeaderData( 1, boost::any( std::string( "2" ) ) );
table->setModel( model );
}
void OnMouseWentUp( const Wt::WModelIndex& i, const Wt::WMouseEvent& e )
{
auto popup = new Wt::WPopupMenu;
popup->addItem( "is not shown..." );
popup->popup( e );
}
};
}
    (1-1/1)