Qt World Summit: Register Today!

How to get the real size of a scrollable Widget

  • Hi there!
    I would like to put 2 QTableWidgets, which are much bigger than the screen is, inside a QScrollArea. I want the QTableWidgets to be placed with their maximum size inside the QScrollArea so that I can scroll them only with the scrollbars of the QScollArea.

    So I did the following:

    @ QFrame* frame = new QFrame(this);
    QVBoxLayout* layout = new QVBoxLayout(frame);
    QScrollArea scroll = new QScrollArea(this);
    jt1 = new MyTabeWidget(this);
    MyTabeWidget* jt2 = new MyTabeWidget(this);

    MyTabeWidget is derived from QTableWidget.
    But if I do so I have a large QMainWindow which holds my QScrollArea, which has no scrollbars, and there are 2 tiny MyTabeWidgets in it having both scrollbars.

    How can I insert the MyTabeWidgets with their maximum sizo, so that they dont have any scrollbars by their own.

    Thank you!

  • Hi,

    Put both QTableWidgets in a vertical layout in a QScrollArea.

    Then set them :
    fixed size

    that should do the trick.

    hope it helps

Log in to reply