[Qt-interest] QScrollArea in QGroupBox

Jason A. Donenfeld Jason at zx2c4.com
Sat Mar 19 07:01:11 CET 2011


Hello,

Sometimes I like to have a long list of buttons that are scrollable:

QWidget -->setLayout
    QVBoxLayout -->addWidget
        QPushButton
        QPushButton
        QPushButton
        QPushButton
        QPushButton
        QPushButton
        QPushButton

Sometimes, I want to make that list scrollable:

QScrollArea -->setWidget
    QWidget -->setLayout
        QVBoxLayout -->addWidget
            QPushButton
            QPushButton
            QPushButton
            QPushButton
            QPushButton
            QPushButton
            QPushButton

Finally, I sometimes want to put that scrollable area inside a QGroupBox:

QGroupBox -->setLayout
    QVBoxLayout --->addWidget
        QScrollArea -->setWidget
            QWidget -->setLayout
                QVBoxLayout -->addWidget
                    QPushButton
                    QPushButton
                    QPushButton
                    QPushButton
                    QPushButton
                    QPushButton
                    QPushButton


This, however, introduces a series of problems. The biggest two I'm
currently encountering are:

   - The scrolling area background inside of the groupbox is a different
   color than the background of the groupbox on OSX. On KDE/Oxygen, it works
   fine.
   - sizeHint()s are not propagating correctly up to the scroll area.

What am I doing wrong? Is there a better way to put a list of widgets inside
a scrolling groupbox? Do you need more information, or from the above, am I
making a clear error?

Thanks,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110319/9b223834/attachment.html 


More information about the Qt-interest-old mailing list