Bug #2541
closedWidgets in Wt::WGridLayout disappear for some rowspan / colspan configurations
0%
Description
As described in this forum thread, WGridLayout seems to swallow widgets when using spans greater than 1. A short test program to reproduce this bug:
#include <Wt/WApplication>
#include <Wt/WColor>
#include <Wt/WContainerWidget>
#include <Wt/WGridLayout>
#include <Wt/WText>
static Wt::WText*
getText(
const Wt::WString& text,
const char* colorName
) {
Wt::WColor color(colorName);
Wt::WText* widget = new Wt::WText(text);
Wt::WCssDecorationStyle decoration;
decoration.setBackgroundColor(color);
widget->setDecorationStyle(decoration);
return widget;
}
class GridDemoApplication : public Wt::WApplication
{
public:
GridDemoApplication(
const Wt::WEnvironment& env
) : Wt::WApplication(env) {
this->root()->setOverflow(Wt::WContainerWidget::OverflowAuto);
Wt::WGridLayout* layout = new Wt::WGridLayout(this->root());
// A
Wt::WText* a = getText("A", "red");
layout->addWidget(a, 0, 0, 1, 1);
// B
Wt::WText* b = getText("B", "blue");
layout->addWidget(b, 1, 0, 2, 1);
}
private:
};
Wt::WApplication
*createApplication(
const Wt::WEnvironment& env
) {
return new GridDemoApplication(env);
}
int
main(
int argc,
char **argv
) {
return Wt::WRun(argc, argv, &createApplication);
}
The result of the above should be a page with a red text field above a blue text field, both occupying half the available space. The actual result is that the whole page is red, while the blue text label has a height of zero pixels (as can be seen by inspecting the page source).
Setting the red widget's row spawn to 2 and the blue widget's row span to one results in an almost blank page with red having a zero pixel height and the blue widget nowhere to be found in the page source.
Similar problems occur when switching row and column spans, the only difference being that the widgets have a zero width instead of a zero height.
Updated by Koen Deforche almost 11 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.2
Updated by Koen Deforche over 10 years ago
- Status changed from InProgress to Resolved
Updated by Koen Deforche over 10 years ago
- Status changed from Resolved to Closed