|
#include <Wt/WApplication>
|
|
#include <Wt/WContainerWidget>
|
|
#include <Wt/WInPlaceEdit>
|
|
#include <Wt/WLength>
|
|
#include <Wt/WSuggestionPopup>
|
|
#include <Wt/WStandardItemModel>
|
|
#include <Wt/WLineEdit>
|
|
#include <Wt/WText>
|
|
#include <Wt/WString>
|
|
#include <Wt/WTableView>
|
|
#include <Wt/WTreeView>
|
|
#include <Wt/WStandardItem>
|
|
#include <Wt/WItemDelegate>
|
|
#include <Wt/WDialog>
|
|
#include <Wt/WPushButton>
|
|
#include <Wt/WAbstractProxyModel>
|
|
#include <Wt/WEvent>
|
|
#include <Wt/WSignal>
|
|
#include <Wt/WModelIndex>
|
|
#include <Wt/WHBoxLayout>
|
|
#include <Wt/WVBoxLayout>
|
|
#include <Wt/WGroupBox>
|
|
#include <Wt/WTemplate>
|
|
#include <Wt/WStackedWidget>
|
|
#include <Wt/WMenu>
|
|
#include <Wt/WServer>
|
|
|
|
#include <boost/bind.hpp>
|
|
#include <boost/foreach.hpp>
|
|
#include <Wt/WPainter>
|
|
#include <Wt/WPaintDevice>
|
|
#include <Wt/WPaintedWidget>
|
|
|
|
using namespace Wt;
|
|
using namespace boost;
|
|
|
|
using std::string;
|
|
|
|
class MyApplication: public WApplication {
|
|
public:
|
|
MyApplication(const Wt::WEnvironment& env);
|
|
};
|
|
|
|
class paint_test : public WPaintedWidget
|
|
{
|
|
public:
|
|
paint_test() : WPaintedWidget(){
|
|
this->setHeight(500);
|
|
this->setWidth(500);
|
|
};
|
|
void paintEvent(WPaintDevice *paintDevice__) {
|
|
WPainter painter__(paintDevice__);
|
|
painter__.setBrush(WColor(0,0,50));
|
|
painter__.setPen(WColor(0,0,50));
|
|
painter__.drawRect(0, 0, 100, 100);
|
|
}
|
|
|
|
};
|
|
|
|
MyApplication::MyApplication(const Wt::WEnvironment& env)
|
|
: Wt::WApplication(env)
|
|
{
|
|
paint_test *test = new paint_test();
|
|
|
|
bool fail__ = true;
|
|
if(fail__) {
|
|
WVBoxLayout *layout = new WVBoxLayout();
|
|
root()->setLayout(layout);
|
|
layout->addWidget(test, 0); // this shows a stretched rectangle
|
|
} else {
|
|
root()->addWidget(test); // this shows a correct rectangle
|
|
}
|
|
}
|
|
|
|
WApplication* createApplication(const Wt::WEnvironment& env)
|
|
{
|
|
WApplication* app = new MyApplication(env);
|
|
return app;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
return Wt::WRun(argc, argv, &createApplication);
|
|
}
|