[Interest] QAbstractScrollAreaPrivate - incorrect viewport rect Qt 5.6.2

Pavlo Shyba pavlo.shyba at globallogic.com
Tue Nov 28 18:07:41 CET 2017


Hi,

Found the interesting behavior when using QListView with viewport margins
and right-to-left languages. ( Qt 5.6.2)
When the direction is rigth-to-left the rectangle is not correct and there
is some suspicious code in QAbstractScrollAreaPrivate::layoutChildren()


 if (q->isRightToLeft())
        viewportRect.adjust(right, top, -left, -bottom);
    else
        viewportRect.adjust(left, top, -right, -bottom);

    viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect,
viewportRect)); // resize the viewport last


Can anybody explain why viewportRect adjusted depending on isRightToLeft?
The logic with adjusting is just to replace right margin to left and
opposite - in that case, QStyle::visualRect will do all job.

In my case I fixed my problem just remove the case with checking isRightToLeft,
as below:

viewportRect.adjust(left, top, -right, -bottom);
viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect,
viewportRect)); // resize the viewport last

Please advice.

-- 

Regards,

Pavlo Shyba


Mobile: +38-096-8760851  Skype:  shyba.pavlo
www.globallogic.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171128/d44b1fc1/attachment.html>


More information about the Interest mailing list