PDA

View Full Version : QTableWidget first column always visible



topino
22nd January 2007, 20:18
Hello,

How can I make, in a QTableWidget, the first column always visible (Not moved by the scroll bar).

Michel :)

charlesD
22nd January 2007, 21:23
Are you trying to make something in addition to the vertical header stationary? I don't know of any way freeze the first column, but I would think that most of the time just having a header for the rows would be good enough - using setVerticalHeaderLabels/Items....

topino
22nd January 2007, 21:51
No, what I would like is, if I move the horizontal scroll bar, the first column will always be visible at the left of the widget.

Michel :)

charlesD
22nd January 2007, 22:27
So are you trying to have two vertical headers? I don't want to seem stubborn or condescending if you are already using a header, but if you aren't using one, adding a vertical header will give you what you want - something that stays in place even when scrolling.

Someone correct me if I'm wrong, but I think in order to freeze a column in place (other than the header) when scrolling, you might need to dig into the Qt source and make some changes.

topino
23rd January 2007, 14:43
I was able to do what I want using two QTableWidgets, side by side. The left widget display the column (one or two) that need to be always visible, and the right widget all the other columns. I connected the signals between the two widgets, so they are in sync. The reason to doing so, is to always show the column that represent the key in a database table. I have something working but I want to know if there is a simpler solution.

Thanks

Michel :)

rpbostock
24th January 2008, 18:08
Interesting.

We solved the same problem by doing the scrollbars ourselves and then hiding and showing the columns to give the illusion of scrolling. Quite messy again, but we haven't come up with a better solution yet.

KillerKing
2nd March 2009, 12:56
This thread seems to be interessting over years :)

I have exactly the same problem.

How did u connect the signal of one scrollbar to two tablewidgets?

fayazabdul
8th January 2010, 09:55
Hi ,

Can you post the code snippet to make the first column always visible.

Thanks...

fayazabdul
8th January 2010, 09:55
Hi ,

I am having the same problem.
Can some body post the code snippet to make the first column always visible.
Thanks in advance.

ChrisW67
11th January 2010, 04:08
Take a look at the Frozen Column Example (http://qt.nokia.com/doc/4.6/itemviews-frozencolumn.html) from 4.6 (also 4.5.3 and possibly earlier) for a way to "freeze" the first column. It's not too difficult to expand to multiple columns. There are some issues with selections crossing the column boundary and also if the columns can be reordered.

Supraja
16th December 2014, 10:04
Hi,

I faced the same problem.If I move the horizontal scroll bar, the first column will always be visible at the left of the widget.I don't want to use two table views for this.By using scroll bars how can I solve this ? Can any one help me ?

RameshNani
16th December 2014, 14:33
I Tried with Frozen Column example but, it's not work for me . Is there any other solution for this .

ChrisW67
17th December 2014, 20:40
Start by keeping your question to the thread you started
http://www.qtcentre.org/threads/61121-How-To-Apply-Scroll-Only-for-few-columns-of-QTableview

Supraja
30th December 2014, 08:06
Hi,

I faced the same problem.If I move the horizontal scroll bar, the first column will always be visible at the left of the widget.I don't want to use two table views for this.By using scroll bars how can I solve this ? Can any one help me ?

Hi,

Can any one please posted the code.