Project

General

Profile

Actions

Bug #3199

closed
KD

setHeaderAlignment and setHeadeWordWrap for TableView crashes my app

Bug #3199: setHeaderAlignment and setHeadeWordWrap for TableView crashes my app

Added by Anonymous over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
05/24/2014
Due date:
% Done:

0%

Estimated time:

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

Before.PNG (19.7 KB) Before.PNG Suresh Easwar, 05/28/2014 06:05 PM
After.PNG (19 KB) After.PNG Suresh Easwar, 05/28/2014 06:05 PM

KD Updated by Koen Deforche over 12 years ago Actions #1

  • 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

SE Updated by Suresh Easwar over 12 years ago Actions #2

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

KD Updated by Koen Deforche over 12 years ago Actions #3

  • Status changed from Feedback to Resolved
  • Assignee set to Koen Deforche

Hey,

Yes, you can listen to the model->columnsInserted() signal.

Regards,
koen

KD Updated by Koen Deforche almost 12 years ago Actions #4

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom