QWidget::SetMinimumHeight() as in line 10:
#include <QtGui>
#include <QDebug>
Q_OBJECT
public:
tb->setMinimumHeight(50);
layout->addWidget(label1);
layout->addWidget(tb);
layout->addWidget(label2);
setStyleSheet("QTabBar { background: green; }"
"QLabel { background: red; }");
central->setLayout(layout);
setCentralWidget(central);
}
};
int main(int argc, char *argv[])
{
MainWindow m;
m.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
#include <QDebug>
class MainWindow: public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *p = 0): QMainWindow(p) {
QWidget *central = new QWidget(this);
QTabBar *tb = new QTabBar(this);
tb->setMinimumHeight(50);
QLabel *label1 = new QLabel("Label 1", this);
QLabel *label2 = new QLabel("Label 2", this);
QVBoxLayout *layout = new QVBoxLayout(central);
layout->addWidget(label1);
layout->addWidget(tb);
layout->addWidget(label2);
setStyleSheet("QTabBar { background: green; }"
"QLabel { background: red; }");
central->setLayout(layout);
setCentralWidget(central);
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow m;
m.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks