Results 1 to 14 of 14

Thread: QTableWidget first column always visible

  1. #1
    Join Date
    Jan 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableWidget first column always visible

    Hello,

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

    Michel

  2. #2
    Join Date
    Jun 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget first column always visible

    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....

  3. #3
    Join Date
    Jan 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget first column always visible

    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

  4. #4
    Join Date
    Jun 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget first column always visible

    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.

  5. #5
    Join Date
    Jan 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget first column always visible

    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

  6. #6
    Join Date
    Jan 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget first column always visible

    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.

  7. #7
    Join Date
    Mar 2009
    Posts
    1
    Qt products
    Qt Jambi
    Platforms
    Windows

    Default Re: QTableWidget first column always visible

    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?

  8. #8
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget first column always visible

    Hi ,

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

    Thanks...

  9. #9
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget first column always visible

    Hi ,

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

  10. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTableWidget first column always visible

    Take a look at the Frozen Column Example 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.

  11. #11

    Default Re: QTableWidget first column always visible

    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 ?

  12. #12
    Join Date
    Feb 2014
    Posts
    43
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget first column always visible

    I Tried with Frozen Column example but, it's not work for me . Is there any other solution for this .

  13. #13
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTableWidget first column always visible

    Start by keeping your question to the thread you started
    http://www.qtcentre.org/threads/6112...-of-QTableview

  14. #14

    Unhappy Re: QTableWidget first column always visible

    Quote Originally Posted by Supraja View Post
    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.

Similar Threads

  1. QTableWidget stretch a column other than the last one
    By roleroz in forum Qt Programming
    Replies: 6
    Last Post: 4th February 2015, 06:35
  2. Replies: 0
    Last Post: 10th November 2006, 13:46
  3. Replies: 6
    Last Post: 13th October 2006, 14:40
  4. QTableWidget column and row sizes
    By Arthur in forum Qt Programming
    Replies: 4
    Last Post: 27th January 2006, 11:03
  5. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 08:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.