December 19, 2010

vlad2048 vlad2048
Lab Rat
6 posts

QAbstractScrollArea: scroll bar style

 

Hi all

Have anybody noticed that subclasses of QAbstractScrollArea (e.g. QTextEdit, QGraphicsView, etc) incorrectly styling their scrollbars? If you just place a QPlainTextEdit and set its scrollbar polices to ScrollBarAlwaysVisible, and then place a QScrollBar near it, they will be painted with different styles on a real device (the QPlainTextEdit would paint its scrollbars with standard Windows style, but the ordinal scrollbars would be painted with a most likely QMacStyle). Does anybody know how to solve this problem.

Also it seems that QAbstractScrollArea implemented assuming a fixed constant scrollbar height and width, and does not take into account the user defined size. When I set the width of vertical scrollbar to a lesser value, the scrollbar remains at the same X coordinate (an unoccupied space left between the right border of scrollbar and the right border of widget). And even move(dx, 0) can’t solve this problem.

Thanks ahead

1 reply

December 19, 2010

peppe peppe
Ant Farmer
1029 posts

vlad2048 wrote:
Hi all

Have anybody noticed that subclasses of QAbstractScrollArea (e.g. QTextEdit, QGraphicsView, etc) incorrectly styling their scrollbars? If you just place a QPlainTextEdit and set its scrollbar polices to ScrollBarAlwaysVisible, and then place a QScrollBar near it, they will be painted with different styles on a real device (the QPlainTextEdit would paint its scrollbars with standard Windows style, but the ordinal scrollbars would be painted with a most likely QMacStyle). Does anybody know how to solve this problem.

Why are you posting this on the mobile forum? It could have made sense if you used a “mobile” style, but you say you’re using a Windows style…

Anyway, a simple test “works for me”. Can you produce a testcase of the problem?

Also it seems that QAbstractScrollArea implemented assuming a fixed constant scrollbar height and width, and does not take into account the user defined size. When I set the width of vertical scrollbar to a lesser value, the scrollbar remains at the same X coordinate (an unoccupied space left between the right border of scrollbar and the right border of widget). And even move(dx, 0) can’t solve this problem.

This is likely to be a bug.

 Signature 

Software Engineer
KDAB (UK) Ltd., a KDAB Group company

 
  ‹‹ How to specify Vendor name, size and version      QLineEdit input Problem ››

You must log in to post a reply. Not a member yet? Register here!