WTreeView outside of WPanel is not displayed
Added by Víctor López almost 14 years ago
Using WTreeView without using a WPanel doesn't display the WTreeView in some browsers (Chromium and Android 2.2 Default Browser).
Using the following code based on the example provided here: http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WStandardItemModel.html#_details
class WDiagnosticsAggDisplay : public Wt::WTreeView
{
public:
WDiagnosticsAggDisplay(Wt::WContainerWidget *parent=0);
void updateModel();
private:
Wt::WStandardItemModel *_itemModel;
};
WDiagnosticsAggDisplay::WDiagnosticsAggDisplay(Wt::WContainerWidget *parent)
: Wt::WTreeView(parent)
{
setSortingEnabled(false);
parent->resize(600,300);
_itemModel = new Wt::WStandardItemModel(this);
updateModel();
resize(300, Wt::WLength::Auto);
this->setModel(_itemModel);
setAlternatingRowColors(true);
setRowHeight(25);
setSelectionMode(Wt::SingleSelection);
}
void WDiagnosticsAggDisplay::updateModel()
{
int topLevelRows = 5;
int secondLevelRows = 7;
Wt::WStandardItem *root = _itemModel->invisibleRootItem();
for (int row = 0; row < topLevelRows; ++row) {
Wt::WStandardItem *topLevel = new Wt::WStandardItem();
root->appendRow(topLevel);
}
}
Using this widget, the WTreeView is seen as in the first 2 images attached (WTreeViewFirefox and WTreeViewChromium).
As you can see, it is not seen properly on Chronium, it also does not work on android (which is my goal).
I looked at the widget gallery source code and found that there a WPanel is added, and the WTreeView placed within.
So, if in the previous code, you replace:
parent->resize(600,300);
With:
Wt::WPanel *panel = new Wt::WPanel(parent);
panel->resize(600, 300);
panel->setCentralWidget(this);
The WTreeView is seen properly as in the 2 last pictures (WTreeViewFirefoxWPanel and WTreeViewChromiumWPanel).
Am I doing something wrong, is this working as intended or should I report it as a bug?
I can live with that WPanel, but it bugs me to add it just so that the page is displayed properly on other browsers.
WTreeViewFirefox (21 KB) WTreeViewFirefox | |||
WTreeViewChromium (21.9 KB) WTreeViewChromium | |||
WTreeViewFirefoxWPanel (23.2 KB) WTreeViewFirefoxWPanel | |||
WTreeViewChromiumWPanel (21.3 KB) WTreeViewChromiumWPanel |
Replies (1)
RE: WTreeView outside of WPanel is not displayed - Added by Koen Deforche almost 14 years ago
Hey Victor,
In my opinion, a bug in webkit CSS handling of height: 100% (it should be ignored, at best). I've fixed this in latest git !
Regards,
koen