Results 1 to 5 of 5

Thread: GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded

  1. #1
    Join Date
    Jan 2006
    Location
    Genk, Belgium
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded

    In QGraphicsView, using the default scrollbar policy Qt::ScrollBarAsNeeded, I observe that the scrollbars do not always appear as needed. In border cases, they seem not to.

    In particular, when one of both scrollbars is visible, the fact that this scrollbar is visible is not taken into account for determining when the other scrollbar must be displayed. For instance, when the horizontal scrollbar is visible, it may be the case that some of my contents is underneath the scrollbar, but not outside the window, without the vertical scrollbar is shown. That is, the content height would be entirely visible if the horizontal scrollbar would not be present.

    And even if both scrollbars are visible, it is inpossible to scroll to the scene contents that lies the most to the right or the bottom of the scene.

    Is this a bug, or am I doing something wrong?

  2. #2
    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: GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded

    Sounds like a bug. Could you provide a minimal compilable example?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Genk, Belgium
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded

    It can easily be demonstrated using the following code:

    Qt Code:
    1. ...
    2. QGraphicsScene* myscene = new QGraphicsScene();
    3. myscene->addText("My very very long text line 1");
    4. myscene->addText("My very very long text line 2")->setPos(QPointF(0,25));
    5. QGraphicsView* myview = new QGraphicsView(myscene);
    6. myview->show();
    7. ...
    To copy to clipboard, switch view to plain text mode 

    Now reduce the window width until the horizontal scrollbar. The entire text is reachable through the scrollbar.
    Now reduce the window height until also the vertical scrollbar appears.
    Two things can be noticed now:
    • The vertical scrollbar appears too late (as if the horizontal scrollbar was not visible).
    • The horizontal scrollbar is not adapted to make the content covered by the vertical scrollbar reachable (you can no longer scroll to the "2").


    In short: using Qt::ScrollBarAsNeeded, a scrollbar does not take into account the area covered by the other scrollbar when it is visible.

    Using Qt::ScrollBarAlwaysOn, the behavior is correct.

    [This behavior shows in Qt 4.2.0 and 4.2.1.]

  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: GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded

    Although that's not compilable, the example is clear and even I can now see the problem. I couldn't find anything relevant on the Task Tracker so I suggest you send a bug report to TT. Ship the example reproducing the problem in together with the textual bug report (just makes their life easier)..
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Genk, Belgium
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded

    I have rapported the bug to TrollTech and they have fixed it in 4.3.

Similar Threads

  1. QTreeWidget + ScrollBar
    By raphaelf in forum Qt Tools
    Replies: 12
    Last Post: 1st June 2006, 20:53
  2. how to scroll tablewidget from outside placed scrollbar
    By chemstar in forum Qt Programming
    Replies: 5
    Last Post: 1st June 2006, 14:42
  3. QTableView number of rows and scrollbar issue
    By jnk5y in forum Qt Programming
    Replies: 3
    Last Post: 1st March 2006, 06:55

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.