View Full Version : How can I always show the horizontalHeader, even if the qtableview is empty?
Zuchao Wang
29th June 2010, 08:41
Currently when the tableview is empty, the horizontalheader will be automatically hidden. But I want it always shown. Is there anyway to do that?
high_flyer
29th June 2010, 09:15
did you try:
pMyTable->horizontalHeader()->setVisible(true); ?
Zuchao Wang
29th June 2010, 10:00
yeah, but it has no effect.
high_flyer
29th June 2010, 10:28
Can you show your code?
Is the table generated in code, or designer?
Zuchao Wang
29th June 2010, 11:42
Sorry, I cannot show my code.
The table is generated by code, and it's totally following the model/view architecture. Basically it looks lke this:
class A: public QAbstractTableModel{...};
class B: pulbic QSortFilterProxyModel{...};
class C: public QTableView{...};
A a;
B b;
C c;
b.setModel(&a);
c.setModel(&b);
Here c is the table. Everything just works fine, except that the horizontalHeader of c automatically disappears when I hide all columns in c. I just want the horizontalHeader always shown.
high_flyer
29th June 2010, 11:58
when I hide all columns in c
This is not the same as:
Currently when the tableview is empty
Hidden is not same as empty.
You probably will have to manually call showSection() on the hidden columns,when you hide you columns.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.