Results 1 to 6 of 6

Thread: QScrollArea scrolling down not up

  1. #1
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QScrollArea scrolling down not up

    I have a very strange problem. I have a widget (my own, inherits QWidget and a .ui file). It has a tab splitterwhich contains a button and a tree widget on the left and a QScrollArea in the right. I put a QTextBrowser into the QScrollArea.

    The problem is that I can only scroll down using the slider. If I want to scroll up, I have to right mouse click in the slider area and use the context sensitive menu.

    I searched for QScrollArea and didn't notice anything like my issue. I noticed the thread:
    http://www.qtcentre.org/forum/f-qt-p...ion-10848.html
    and the dialog that does contain this widget has no window title and receives mouse events. However I added "event->ignore();" to all the mouse events and nothing changed.

    Has anyone run into anything like this?
    Last edited by ntp; 14th August 2008 at 21:47.

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

    Default Re: QScrollArea scrolling down not up

    I'm not able to reproduce your problem using Qt Designer. Could you post the ui file (or a small compilable application) here that would show what you mean?

  3. #3
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollArea scrolling down not up

    I have attached a small example. It does work in the designer but once you actually make an app, it doesn't. It doesn't matter whether or not I put the text browser in the QScrollArea through designer or through code.

    I can even reproduce it with a regular titlebar and no mouse events.

    I have noticed the same behavior on windows and mac and I am using the latest 4.4.1.

    Thanks.
    Attached Files Attached Files
    Last edited by ntp; 15th August 2008 at 02:00.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QScrollArea scrolling down not up

    Wait a minute. QTextBrowser is already scrollable. What's the point placing it inside a QScrollArea?
    J-P Nurmi

  5. #5
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollArea scrolling down not up

    I have lots of other custom widgets and a tab widget in the scroll area. The text widget is inside of the tab widget. The example that I gave you is just a minimized version of what I do to duplicate the problem.

    I just substituted the following code in MainWidget.cpp to use a QLabel instead of QTextBrowser and I still see the problem:

    Qt Code:
    1. QLabel* label = new QLabel(this);
    2. scrollArea_->setWidget(label);
    3. label->setText("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n");
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollArea scrolling down not up

    Turns out the culprit was the fact that I had:
    Qt Code:
    1. setStyleSheet("background-color: rgb(240,240, 240)");
    To copy to clipboard, switch view to plain text mode 

    in the mainDialog.cpp

    This propagated to widgets that cannot be styled this way. In order to style the scrollbar, it looks like I am going to have to style each part of the scrollbar.
    stylesheet description for scrollbar

    I was hoping that I could set the color of my entire application in one call but it looks like I am going to have to be a little more detailed than that.

Similar Threads

  1. ScrollBar inside QTreeWidget is Blurring on Scrolling
    By santosh.kumar in forum Qt Programming
    Replies: 0
    Last Post: 11th April 2008, 14:33
  2. QGraphicsView scrolling problem with 4.3.0
    By hb in forum Qt Programming
    Replies: 8
    Last Post: 30th August 2007, 22:18
  3. QScrollArea and resizing
    By rarefluid in forum Qt Programming
    Replies: 8
    Last Post: 22nd July 2007, 14:18
  4. Scrolling bar problem in QScrollArea
    By YuriyRusinov in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2007, 21:22
  5. Replies: 2
    Last Post: 8th October 2006, 20:14

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.