PDA

View Full Version : How to set QHeaderViews are siblings



RameshNani
3rd February 2015, 14:49
Hi I would like to set one qheaderview understack of other , so how could i make two QHeaderViews are siblings each other.
I created like
QHeaderView *m_header = new QHeaderView(Qt::Horizantal,this)
QHeaderView *m_headerN = new QHeaderView(Qt::Horizantal,this)

but when i apply m_headerN ->stackUnder(m_header ) it's not working . Could any one suggest me .

anda_skoa
3rd February 2015, 16:21
Weird, this sounds a lot like your earlier question here http://www.qtcentre.org/threads/61513-How-to-set-One-Headerview-underneath-of-Other

What is the difference?

Cheers,
_

d_stranz
3rd February 2015, 17:17
If you ask the same confused question enough times, in different ways, maybe someone will figure out what you're really trying to do?



QHeaderView *m_header = new QHeaderView(Qt::Horizantal,this)
QHeaderView *m_headerN = new QHeaderView(Qt::Horizantal,this)


I would be interested to know how you get this to compile. If you're going to paste code, paste the actual code, not something made up on the spot, and use [CODE] tags.

RameshNani
4th February 2015, 03:57
Hi I Posted all my code on http://www.qtcentre.org/threads/61121-How-To-Apply-Scroll-Only-for-few-columns-of-QTableview link with code tags , my problem is setup some columns from left side act like freezed ,am able to freez the columns but the headers are overlapped on one other , means the second tableview header under stack of 1st tableview header , but it's act opposite , when i search in forum we only handle stackunder when the both headers are siblings . so i tried above way but it's not working .

wysota
4th February 2015, 07:55
It is not possible to control stacking order of widgets which are not siblings. If you want to have total control over headers of different views then hide the original headers of both views, instantiate new set of headers outside the views, provide some glue code that will synchronize the custom headers with the original ones and you are good to go.

RameshNani
4th February 2015, 09:31
Hi How could i set headers outside of the views ?

wysota
4th February 2015, 14:02
The same way you set any widget outside any other widget, by not making it its child.

RameshNani
5th February 2015, 04:29
you mean can i take two header views and set them into layout on top of views ?
like :
QHeaderView *m_header= new QHeaderView();
QHeaderView *m_header1 = new QHeaderView();
m_header->setModel(model());
m_header1 ->setModel(model());
layout->addWidget(m_header);
layout->addWidget(m_header1 );

wysota
5th February 2015, 06:36
I don't think putting them in a layout will do you much good.

RameshNani
5th February 2015, 15:31
Hi I have one more issue with frozen columns , when i given dynamic number of columns other than one column it's freezing , but when i click on columns the values are changing i mean the columns are moving .

Added after 1 51 minutes:

Hi FrozenColumn example not working , it's only working for one column , it's not working for more columns . could any one suggest me where can i do changes for multiple columns , the columns are dynamically coming how many number of columns come to frozenview.

ChrisW67
7th February 2015, 07:46
You need to read the Frozen Column example and understand how it works then the problem becomes easier.

Attached is a modified version of the Qt5 example with a custom header and two frozen columns. Look for <<<<<< in the code.

Hopefully this will put an end to all four threads on this topic:

61516
61121
61513
64175

RameshNani
10th February 2015, 15:51
Thanks Chris it's fixing all my issues .