Results 1 to 12 of 12

Thread: no horizontal scroll bar in QTableWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no horizontal scroll bar in QTableWidget

    Quote Originally Posted by Ashkan_s View Post
    use
    Qt Code:
    1. setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    To copy to clipboard, switch view to plain text mode 
    its not working. Qt::ScrollBarAsNeeded is a default value that used in designer. i tried to set it manualy, thats what i got:no_effect.png

  2. #2
    Join Date
    Sep 2012
    Location
    Iran, Tehran
    Posts
    76
    Thanks
    17
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: no horizontal scroll bar in QTableWidget

    I think this is because you have only one column (at least it seems so from the picture) and the column (not its contents) is visible so scrolling is not needed.
    Last edited by Ashkan_s; 17th October 2012 at 10:59. Reason: spelling corrections

  3. #3
    Join Date
    Oct 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no horizontal scroll bar in QTableWidget

    Quote Originally Posted by Ashkan_s View Post
    I think this is because you have only one column (at least it seems so from the picture) and the column (not its contents) is visible so scrolling is not needed.
    thats right. i have added second column and scroll was appeared. thank you very much!
    but what is the reason of that behavior? am i have to add a fictive column to see the scroll?

  4. #4
    Join Date
    Sep 2012
    Location
    Iran, Tehran
    Posts
    76
    Thanks
    17
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: no horizontal scroll bar in QTableWidget

    am i have to add a fictive column to see the scroll?
    try this: change the scrolling mode to ScrollPerPixel and set a minimum width for the QTableWidget's horizontal header, for example
    Qt Code:
    1. tb.setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
    2. tb.horizontalHeader()->setMinimumWidth(minwidth);
    To copy to clipboard, switch view to plain text mode 
    here tb is QTableWidget.

  5. #5
    Join Date
    Oct 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no horizontal scroll bar in QTableWidget

    it works too. thanks!

Similar Threads

  1. Replies: 9
    Last Post: 10th October 2012, 12:17
  2. Horizontal scroll bar on QTreeView
    By LynneV in forum Qt Programming
    Replies: 7
    Last Post: 9th November 2010, 21:05
  3. Resizing QTableView to eliminate horizontal scroll bar?
    By russford in forum Qt Programming
    Replies: 7
    Last Post: 18th March 2010, 07:21
  4. Vertical scroll bar, but resizable horizontal content
    By minimoog in forum Qt Programming
    Replies: 0
    Last Post: 14th January 2009, 20:51
  5. ListWidget horizontal scroll.
    By patrick772goh in forum Qt Tools
    Replies: 3
    Last Post: 17th July 2007, 07:32

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.