Bug #3199
closedsetHeaderAlignment and setHeadeWordWrap for TableView crashes my app
0%
Description
I derived a class from WTableView to obtain an extra row below the header (for filter data input). But it's not clear where I should call the following:
setHeaderAlignment(column, Wt::AlignTop);
setHeaderWordWrap(column, false);
If I call them as shown below my program crashes.
My class is:
class MyTableView : public Wt::WTableView {
public:
MyTableView(Wt::WContainerWidget* parent = 0) : Wt::WTableView(parent)
{
setHeaderHeight(40, true);
}
Wt::WWidget* createExtraHeaderWidget(int column)
{
setHeaderAlignment(column, Wt::AlignTop);
setHeaderWordWrap(column, false);
return new Wt::WLineEdit(dynamic_cast<Wt::WContainerWidget*>(parent()));
}
};
Another quirk I noticed is I get these warnings:
[2014-May-23 16:33:39.321065] 39039 [/ GDkSlgc77gWJzoDt] [warning] "WContainerWidget: addWidget(): reparenting widget"
Thanks
Suresh
Files
Updated by Koen Deforche almost 11 years ago
- Status changed from New to Feedback
Hey,
The following calls need to be done at contruction time (not from within createExtraWidget()):
setHeaderAlignment(column, Wt::AlignTop | Wt::AlignJustify);
setHeaderWordWrap(column, false);
Regards,
koen
Updated by Suresh Easwar almost 11 years ago
- File Before.PNG Before.PNG added
- File After.PNG After.PNG added
The problem is that at construction time my model does not necessarily know the number of columns it will contain. it actually starts with 0 rows and 0 columns. Is there a 'column-added' signal that I can listen for and put these calls in the corresponding slot?
In any case, to test out the calls, I forced the model to start with a fixed number of columns. Now I do see the edit boxes below the headers. But when I try to shrink the column widths, the edit box disappears and the header is squished one line below. I attached images to show the problem.
Thanks
Updated by Koen Deforche almost 11 years ago
- Status changed from Feedback to Resolved
- Assignee set to Koen Deforche
Hey,
Yes, you can listen to the model->columnsInserted() signal.
Regards,
koen
Updated by Koen Deforche over 10 years ago
- Status changed from Resolved to Closed