Results 1 to 9 of 9

Thread: Auto Scrolling QListWidgetItem

  1. #1
    Join Date
    Oct 2011
    Posts
    2
    Qt products
    Qt3
    Platforms
    MacOS X

    Lightbulb Auto Scrolling QListWidgetItem

    Hello All,
    In my program I have used a QlistWidget . Sometimes Item string are longer the space provided.
    So I need to scroll my Text to and fro in order to show the full item string.


    Please Help

  2. #2
    Join Date
    Jan 2012
    Posts
    8
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Auto Scrolling QListWidgetItem

    Hmmm... I just wrote a sample program, and there the scroll bars appeared. So what's your problem exactly?
    Qt Code:
    1. int main( int argc, char *argv[] )
    2. {
    3. QApplication a(argc, argv);
    4.  
    5. QListWidget oListWidget;
    6. new QListWidgetItem( QObject::tr(" sdlfjksdfsdlfkjs dflksjd lfksjdfl ksdjf sdf"), &oListWidget);
    7. oListWidget.show();
    8.  
    9. return a.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    Otherwise you can wrap a QScrollArea around: http://doc.qt.nokia.com/4.7/qscrollarea.html#details

  3. #3
    Join Date
    Oct 2011
    Posts
    2
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: Auto Scrolling QListWidgetItem

    Actually I dont need a scroll bar.
    I need when I select a particular Item of the QList Widget, if its length is longer than the space provided it should move to and fro to show the full string

    I hope i could xplain

    Thnx

  4. #4
    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: Auto Scrolling QListWidgetItem

    Like the HTML marquee element along with all its failings?

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,243
    Thanks
    303
    Thanked 866 Times in 853 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Auto Scrolling QListWidgetItem

    Let's just suppose that, for whatever insane reason, one actually wanted to implement this. I'm trying to guess at how one might go about it.

    My initial idea is to implement a QLineEdt delegate that, when displayed, would include a timer that would step the cursor position along one character at a time, either forward or backward, each time it fired. Would that be feasible?

  6. #6
    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: Auto Scrolling QListWidgetItem

    The problem I see is that when you are not editing the cell in the QTableView there is no widget that you can do this with. When you are editing the cell you want a standard QLineEdit rather than trying to edit a bouncing message

    You could render the text with a (sometimes) variable offset in the delegate paint() routine, but the delegate paint routine would only be called when it is required to repaint a particular cell (value changes or scrolls into view). The trick would be how to get this to fire periodically without forcing the redraw (update() or repaint()) of the whole QTableView. Not obvious to me.

  7. #7
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,243
    Thanks
    303
    Thanked 866 Times in 853 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Auto Scrolling QListWidgetItem

    When you are editing the cell you want a standard QLineEdit rather than trying to edit a bouncing message
    Ah, yes, very true. With my solution it would be like editing karaoke. And you certainly wouldn't want every cell to be continuously scrolling back and forth, only the selected one.

    Never mind - anything that I can envision would be hideous.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Auto Scrolling QListWidgetItem

    Quote Originally Posted by ChrisW67 View Post
    The trick would be how to get this to fire periodically without forcing the redraw (update() or repaint()) of the whole QTableView. Not obvious to me.
    It's not a big deal. One calls update() on the view's viewport using QAbstractItemView::visualRect(). Provided one uses Qt4 despite that his profile says otherwise (yeah, I know there is no QListWidgetItem in Qt3).

    The epilepsy-warning issue still remains, though. I can't even think what it would look like if the text was spinning in multiple cells at once.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    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: Auto Scrolling QListWidgetItem

    Ahh, you live and you learn.

Similar Threads

  1. Auto-scrolling QTextBrowser
    By MTK358 in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2012, 10:43
  2. Disable auto-scrolling in QPlainTextEdit
    By lukass in forum Newbie
    Replies: 2
    Last Post: 21st February 2011, 11:31
  3. auto scrolling QTextEdit
    By msmihai in forum Newbie
    Replies: 1
    Last Post: 8th January 2009, 20:08
  4. How did I disable auto-scrolling function in tree-view
    By alfa_wu in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2007, 09:31
  5. about QListWidgetItem
    By Pang in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2007, 10:14

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.