Important: Please read the Qt Code of Conduct -

QTextBrowser with texttables, to large for self and/or MainWindow

  • I am making a calendar much like the one in the calendar example. It's a text browser with tables in it and represents the next 5 weeks. I have a minimum of 5 lines in each cell to keep things tidy, it will add '\n' if necessary.

    The problem is the calendar is bigger than the browser is allowing. It's adding the slider to the right side. I don't want a slider I want the whole thing to show up. I've tried messing with size policies but haven't gotten it right. So how do I tell QT to display the whole browser and NEVER chop it up or use a slider?

    BTW I have no layouts set up. And the size the browser is choosing is to small on the height, the width seems ok for now.


    As you can see it appears the browser and the window are not being created large enough. Fiddling with the size of the mainwindow does nothing it resizes to the size in the picture on creation.

  • Moderators

    You probably need to take a look at "Qt::ScrollBarPolicy": Although if you had used layouts, it might have worked out of the box. In order to adjust the height, you need to use the SizeHint property of the widget. In some cases automatic calculation may fail. First, try updating the height, if it does not work, calculate your own.

Log in to reply