Quote Originally Posted by wysota View Post
It's practically impossible to do that because of the use of PIMPLs by Qt widgets.
PIMPLs ?? What do you mean. I've looked inside and it's difficult, so it's my last option... ( but you can never say is impossible... )

Not the best idea, you'll be practically reimplementing the whole view interface.
I disagree. I don't need ALL the interface. I f you do something like this, you have all the interface, but are allways maintaining it as a single Widget :

Qt Code:
  1. MTableView::MTableView ( QWidget * parent ) : QWidget ( parent )
  2. {
  3. // 3 parts : TOP, CENTRAL & FOOTER
  4. QVBoxLayout * vboxLayout = new QVBoxLayout ( this );
  5. vboxLayout->setSpacing(0);
  6. vboxLayout->setMargin(0);
  7. vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
  8.  
  9. // TOP : Band headers
  10. QHeaderView * tTopBand = new QHeaderView ( Qt::Horizontal, this );
  11. tTopBand->setObjectName ( QString::fromUtf8 ( MTable_TOPBAND ) );
  12. tTopBand->setMinimumHeight ( 20 );
  13. tTopBand->setMaximumHeight ( 20 );
  14. QSizePolicy spTop ( QSizePolicy::Expanding, QSizePolicy::Fixed );
  15. spTop.setHorizontalStretch(0);
  16. spTop.setVerticalStretch(0);
  17. tTopBand->setSizePolicy ( spTop );
  18. vboxLayout->addWidget ( tTopBand );
  19.  
  20. // CENTRAL : Data & column headers
  21. QTableView * tMainGrid = new QTableView ( this );
  22. tMainGrid->setObjectName ( QString::fromUtf8 ( MTable_CENTRAL ) );
  23. QSizePolicy spCentral ( QSizePolicy::Expanding, QSizePolicy::Expanding );
  24. spCentral.setHorizontalStretch(0);
  25. spCentral.setVerticalStretch(0);
  26. tMainGrid->setSizePolicy ( spCentral );
  27. vboxLayout->addWidget ( tMainGrid );
  28.  
  29. tMainGrid->setSelectionBehavior ( QAbstractItemView::SelectRows );
  30. tMainGrid->setSelectionMode ( QAbstractItemView::SingleSelection );
  31.  
  32. tMainGrid->verticalHeader()->setDefaultSectionSize ( 20 );
  33. tMainGrid->verticalHeader()->setMinimumSectionSize ( 20 );
  34. tMainGrid->horizontalHeader()->setDefaultSectionSize ( 120 );
  35. tMainGrid->horizontalHeader()->setMinimumSectionSize ( 20 );
  36.  
  37. // FOOTER : Summary @ column footers
  38. QHeaderView * tFooter = new QHeaderView ( Qt::Horizontal, this );
  39. tFooter->setObjectName ( QString::fromUtf8 ( MTable_FOOTER ) );
  40. tFooter->setMinimumHeight ( 20 );
  41. tFooter->setMaximumHeight ( 20 );
  42. QSizePolicy spFooter ( QSizePolicy::Expanding, QSizePolicy::Fixed );
  43. spFooter.setHorizontalStretch(0);
  44. spFooter.setVerticalStretch(0);
  45. tFooter->setSizePolicy ( spFooter );
  46. vboxLayout->addWidget ( tFooter );
  47.  
  48. // connections
  49. connect ( tMainGrid->horizontalHeader(), SIGNAL(sectionResized(int,int,int)) ,
  50. tTopBand, SLOT(resizeSection(int,int,int)));
  51. connect ( tMainGrid->horizontalHeader(), SIGNAL(sectionResized(int,int,int)) ,
  52. tFooter , SLOT(resizeSection(int,int,int)));
  53. }
To copy to clipboard, switch view to plain text mode 

I only need that the improved table acts as a single widget, allowing the final developer to easily create layouts with the designer & then having a richer table in his project.

Why not try another approach - simply insert a second header view in the layout of the view just under the viewport?
Well. I'm working this way because I'm creating a complex framework that loads .ui files, changing QTableView elements by "MTableView" ( my class ). I use inside my app this class and I can assume has an smaller interface.

You can always hide them...
Why I must hide a compoenent I'm fighting to show ? I want to show this :

- 1 horizontal "band header" ( each band contains 1 or more columns grouped ) BEFORE the table header
- The QTableView itself ( column headers & data )
- 1 table footer, for summarys. I can assume the scroll bar is between data & footer, by now it's not a problem.

I'm not sure (you can verify that by looking into Qt sources), but I think you should calculate section sizes yourself according to the width of columns.
OK, I agree too, but I must receive some signals when column header change thier size, and I don't receive nothing.

- How can I handle the propagation of grid's column resizing to band header & footer. And of course, band resizing must affect table header & footer...

Signals & slots again...
OK, but which signals ?? I've tried some combinations and I'm receiving no one...

Thanks