本文整理汇总了C++中QMenuBar::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar::setSizePolicy方法的具体用法?C++ QMenuBar::setSizePolicy怎么用?C++ QMenuBar::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenuBar
的用法示例。
在下文中一共展示了QMenuBar::setSizePolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
VisualizerContainer::VisualizerContainer(QMdiArea *container, voxie::visualization::Visualizer *visualizer) :
QWidget(nullptr),
//icon(":/icons/application-blue.png"),
icon(visualizer->icon()),
visualizer(visualizer),
container(container),
window(nullptr)
{
visualizer->setParent(this);
this->setWindowTitle(this->visualizer->mainView()->windowTitle());
this->setWindowIcon(icon);
{
QVBoxLayout *layout = new QVBoxLayout();
layout->setMargin(0);
layout->setSpacing(0);
{
QMenuBar *bar = new QMenuBar();
bar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
QAction *popOutAction = bar->addAction("&Pop Out");
connect(popOutAction, &QAction::triggered, this, &VisualizerContainer::switchPopState);
layout->addWidget(bar);
layout->addWidget(visualizer->mainView());
}
this->setLayout(layout);
}
this->moveToNewMdiChild();
}
示例2: setupWidgets
void TestWidget::setupWidgets(void)
{
setWindowTitle(this->title);
QMenuBar *menubar = new QMenuBar(this);
QMenu *menu = new QMenu(QString("Title: ") + this->title);
QAction *action_reproduce = new QAction("Reproduce", this);
menu->addAction(action_reproduce);
menubar->addMenu(menu);
setMenuBar(menubar);
menubar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setCentralWidget(new QWidget(this));
centralWidget()->setLayout(new QVBoxLayout(centralWidget()));
QPushButton *button = new QPushButton("Reproduce", this);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
centralWidget()->layout()->setContentsMargins(0,0,0,0);
centralWidget()->layout()->setSpacing(0);
centralWidget()->layout()->addWidget(button);
connect(action_reproduce, SIGNAL(triggered()), SLOT(reproduce()));
connect(button, SIGNAL(clicked()), SLOT(reproduce()));
}