Results 1 to 7 of 7

Thread: Resizable width of vertical Header in QTableWidget

  1. #1
    Join Date
    Aug 2016
    Posts
    4
    Thanks
    1
    Qt products
    Platforms
    Windows

    Default Resizable width of vertical Header in QTableWidget

    Hello,

    I program currently a GUI with PyQt and I've created a QTableWidget where vertical and horizontal headers are visible.

    My problem is currently that I can not change the width of the vertical header with the mouse. The width of the other columns can I change already.

    Changeable width:
    2016-08-2513_15_03-testcaseupd.png

    Not Changeable width:
    2016-08-2513_16_41-testcaseupd.png

    My question is whether it is possible to make the width of vertical header resizable.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,403
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Resizable width of vertical Header in QTableWidget

    I don't see any vertical header, but maybe you mean the first column/section of the horizontal header?

    You could try calling QHeaderView::setSectionResizeMode() for section 0.

    Cheers,
    _

  3. #3
    Join Date
    Aug 2016
    Posts
    4
    Thanks
    1
    Qt products
    Platforms
    Windows

    Default Re: Resizable width of vertical Header in QTableWidget

    @anda_skoa: the vertical Header is exists (see image) and i use this function already, but it set only the size mode of Sections and not of vertical headers.

    2016-08-2600_58_44-testcaseupd.png

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,403
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Resizable width of vertical Header in QTableWidget

    You could try setting the size policy of the vertical header view so that it allows shrinking.

    Cheers,
    _

  5. #5
    Join Date
    Aug 2016
    Posts
    4
    Thanks
    1
    Qt products
    Platforms
    Windows

    Default Re: Resizable width of vertical Header in QTableWidget

    i try it but nothing has changed.


    Added after 19 minutes:


    My Problem is that some vertical header in my QTableWidget have a long names. So as altenative for resizable vertical header i want to set a fixed width fo the Header and make a text elided.

    My Question is how can i make a text of a header elided?

    Thanks
    Last edited by zizou2981; 26th August 2016 at 12:52.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,403
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Resizable width of vertical Header in QTableWidget

    Since you wrote QTableWidget, do you set header items for the vertical header?

    If setting different size hint does not work, you could try setting elided texts, e.g. using QFontMetrics::elidedText().

    Cheers,
    _

  7. The following user says thank you to anda_skoa for this useful post:

    zizou2981 (26th August 2016)

  8. #7
    Join Date
    Aug 2016
    Posts
    4
    Thanks
    1
    Qt products
    Platforms
    Windows

    Default Re: Resizable width of vertical Header in QTableWidget

    Thanks for your help anda_skoa. I use now elided text with fixed header width and it works.

Similar Threads

  1. Replies: 1
    Last Post: 21st August 2015, 20:36
  2. Cannot hide QTableWidget's vertical header.
    By adutzu89 in forum Newbie
    Replies: 2
    Last Post: 25th January 2014, 11:12
  3. change Qtablewidget vertical header displayrole
    By advseo32 in forum Qt Programming
    Replies: 10
    Last Post: 12th August 2013, 13:21
  4. Replies: 1
    Last Post: 6th August 2013, 21:44
  5. Replies: 3
    Last Post: 20th January 2011, 13:24

Tags for this Thread

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.