[Qt-interest] setHorizontal/setVerticalHeader misbehaves (or perhaps QHeaderView does) after show
Denis Akhmetzyanov
dakhmetzyanov at smartlabs.tv
Thu Apr 8 11:24:44 CEST 2010
Hi,
I think this behavior is not bug. If we add child to the visible widget, the
child is not became visible by default. To show him we can: 1) hide & show
his parent 2) explicitly call show() for the child. Thus
method my_app::pressed() replaced "visible" headers with "invisible".
This code works as expected:
...
void my_app::pressed() {
qDebug() << "Pressed";
view->setHorizontalHeader(new QHeaderView(Qt::Horizontal, view));
view->setVerticalHeader(new QHeaderView(Qt::Vertical, view));
view->horizontalHeader()->show();
view->verticalHeader()->show();
}
or second variant (is slower than first):
void my_app::pressed() {
qDebug() << "Pressed";
view->hide();
view->setHorizontalHeader(new QHeaderView(Qt::Horizontal, view));
view->setVerticalHeader(new QHeaderView(Qt::Vertical, view));
view->show();
}
2010/4/8 Esben Mose Hansen <kde at mosehansen.dk>
> Hi,
>
> if you compile and run the following example, and press the buttom, you'll
> note that the headers disappear. This caused by calling
> setHorizontalHeader()
> and setVerticalHeader(), using a standard QHeaderView class. Yet, this is
> not
> the behaviour I get if I make the calls before showing the QTableView.
>
> Bug/feature? I haven't been able to find the bug in Qt's bugtracker. If
> noone
> can come up with an explanation for this odd behaviour, I think I'll file a
> bug.
>
> --
> kind regards, Esben
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
Best regards,
Denis Akhmetzyanov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100408/ea4d97f1/attachment.html
More information about the Qt-interest-old
mailing list