Results 1 to 5 of 5

Thread: QItemDelegate and Scrolling

  1. #1
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default QItemDelegate and Scrolling

    Hello,

    in a QTableView I have a column with text, which should be scrollable. I know I need a Delegate to do this and I have tried several approaches with QPlainTextEdit:

    + setting the widget with setIndexWidget. This does not seem to work, its not painting anything (and Its very slow!)
    + using somthing like QApplication::style()->drawControl(QStyle::CE_ProgressBar, opts, painter, 0); but there is no CC or CE for a Plain Text Widget (taken from http://www.qtcentre.org/threads/2330...QTreeView-item)
    + I have tried using paint, drawFrame and render on QPlainTextWidget, but no luck so far

    I have read all posts here and on google which could provide the smallest hint on how to solve this. But seems I miss something really basic.... Perhaps sombody can point me to some other possible solution.

    Thanks

    Sebastian

  2. #2
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QItemDelegate and Scrolling

    I'm not sure what you are trying to do - scroll up and down the table or within a cell.

    In my QTableView, if I doubleclick in a cell with more text in it than shows in the view, it automatically expands to show all of the text as long as the mouse cursor is over the cell.

  3. #3
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QItemDelegate and Scrolling

    Yes i try to provide scrollbars in a table cell while in QDisplayRole. did you get your behaviour for free or did you have to code it? How does an user know that there is more Text than they can see? Ill try this tomorrow. Thanks for the heads up. Anyone else got a suggestion?

  4. #4
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QItemDelegate and Scrolling

    If you want to have a custom behaviour for scrolldowm you have to subclass QStyle ( QStyle controls everything in terms of display) .
    But before doing so, can you tell us where the default behaviour doesn't suit your needs .

  5. #5
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QItemDelegate and Scrolling

    Hmm... which default behaviour? I am not seeing anything what you or waynew described. The text is just cut off not matter how much i double click or leave the mouse over the cell.

    To make myself clear:
    The problem: Too much text in one cell.
    The desired solution: scrolling text in the cell (in display role), but I'm open for other ideas

Similar Threads

  1. QPushButton in QItemDelegate
    By allbabel in forum Qt Programming
    Replies: 0
    Last Post: 2nd April 2009, 11:45
  2. QItemDelegate and QCheckBox
    By KShots in forum Qt Programming
    Replies: 5
    Last Post: 19th November 2008, 00:49
  3. QItemDelegate
    By Alex_123 in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2008, 11:40
  4. Using most of QItemDelegate
    By joshuajcarson in forum Qt Programming
    Replies: 4
    Last Post: 6th October 2008, 16:02
  5. QItemDelegate
    By cyberboy in forum Qt Programming
    Replies: 10
    Last Post: 27th June 2008, 17:41

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.