QWidget containing two QToolButtons
Hi! I want to set a QWidget that is composed of two QToolButtons as the cornerWidget of a QTabWidget, but it doesnt work. The buttons are being squeezed and aren't usable any more. Outside of the QTabWidget the widget looks ok.
Any Ideas?
Thanx
Code:
#include <QApplication>
#include <QtGui>
// #include "main.moc"
int main(int argc, char **argv)
{
// layout
lo->addWidget(butA);
lo->addWidget(butB);
tabWidget
->addTab
(new QWidget(),
"test tab");
tabWidget->setCornerWidget(w, Qt::TopRightCorner);
tabWidget->show();
return app.exec();
}
Re: QWidget containing two QToolButtons
I think you'll need to alter the width and height of scrollbars to be able to put a larger than expected widget there. And that involves changing the application style or enforcing static sizes through manual setMinimumSize() calls.
Re: QWidget containing two QToolButtons
Someone in the qt irc room pointed me towards another solution. setting the Layouts contents margin to 0.
QLayout::setContentsMargins(0,0,0,0); does the job. he docs say: "Only the horizontal element of the corner will be used.".
That's what I was told in the irc channel:
Quote:
the corner widget respects the horizontal sizehint, but not the vertical, so it was allocating extra horizontal height for the margins, but not vertically... instead it squashed it.
Applied the proposed change and it works.
Thanks