|
/*
|
|
* To drive failure, start in window over 200px high, then move resizer to upper limit
|
|
*/
|
|
|
|
#include <Wt/Chart/WCartesianChart.h>
|
|
#include <Wt/WApplication.h>
|
|
#include <Wt/WEnvironment.h>
|
|
#include <Wt/WStandardItemModel.h>
|
|
#include <Wt/WVBoxLayout.h>
|
|
|
|
using namespace Wt;
|
|
|
|
class TestApp : public WApplication {
|
|
public:
|
|
TestApp(const WEnvironment& env);
|
|
};
|
|
|
|
TestApp::TestApp(const WEnvironment& env) : WApplication(env)
|
|
{
|
|
setTitle("WPaintedWidget w/setMinimumSize() fails to resize in layout");
|
|
|
|
auto model = std::make_shared<WStandardItemModel>(200, 3);
|
|
for (int r = 0; r < model->rowCount(); ++r)
|
|
for (int c = 0; c < model->columnCount(); ++c)
|
|
model->setData(model->index(r, c), r * ((c == 1) ? 1 : -1));
|
|
|
|
auto topLayout = root()->setLayout(std::make_unique<WVBoxLayout>());
|
|
|
|
auto chart1 = topLayout->addWidget(std::make_unique<Chart::WCartesianChart>());
|
|
|
|
/*
|
|
* NOTE: will also fail with the following setMinimimuSize line disabled:
|
|
* The resizer will also stop responding if you drag it to the top, although the display will look OK
|
|
* It will be covered by the canvas from the top chart.
|
|
*/
|
|
chart1->setMinimumSize(WLength::Auto, 200);
|
|
chart1->setModel(model);
|
|
chart1->addSeries(std::make_unique<Chart::WDataSeries>(1));
|
|
|
|
auto chart2 = topLayout->addWidget(std::make_unique<Chart::WCartesianChart>());
|
|
chart2->setModel(model);
|
|
chart2->addSeries(std::make_unique<Chart::WDataSeries>(2));
|
|
|
|
topLayout->setResizable(0);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
WLayout::setDefaultImplementation(LayoutImplementation::JavaScript);
|
|
return WRun(argc, argv, [](const WEnvironment& env) {return std::make_unique<TestApp>(env);});
|
|
}
|