本文整理汇总了C++中QMenuBar::setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar::setMinimumWidth方法的具体用法?C++ QMenuBar::setMinimumWidth怎么用?C++ QMenuBar::setMinimumWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenuBar
的用法示例。
在下文中一共展示了QMenuBar::setMinimumWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillToolBars
///
/// Public Funcitons
///
//!
//! Fills the given tool bars with actions for the TableViewPanel view.
//!
//! \param mainToolBar The main tool bar to fill with actions.
//! \param panelToolBar The panel tool bar to fill with actions.
//!
void TableViewPanel::fillToolBars ( QToolBar *mainToolBar, QToolBar *panelToolBar )
{
// Temp
QAction *ui_descriptionAction;
ui_descriptionAction = new QAction(this);
ui_descriptionAction->setObjectName(QString::fromUtf8("ui_descriptionAction"));
ui_descriptionAction->setCheckable(true);
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/infoIcon"), QSize(), QIcon::Normal, QIcon::Off);
ui_descriptionAction->setIcon(icon1);
ui_descriptionAction->setToolTip("Show Description");
connect(ui_descriptionAction, SIGNAL(toggled(bool)), this, SLOT(showDiscription(bool)));
// Column visibility select control
// Place holder for drop down to select which columns of table are visible
// This should be populated with column names
QAction *visibilityAct = new QAction(tr("&Select Columns..."), this);
visibilityAct->setStatusTip(tr("Select columns for visibility..."));
connect(visibilityAct, SIGNAL(triggered()), this, SLOT());
QMenu *visibilityMenu = new QMenu();
visibilityMenu->addAction(visibilityAct);
visibilityMenu->addSeparator();
QString menuStyleSheet (
"QMenuBar {"
" border: none;"
" margin: 0px;"
" padding: 0px;"
" background: none;"
"}"
"QMenuBar::item {"
" background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #a5a5a5, stop:0.2 #999999, stop:0.8 #b0b0b0, stop:1 #555555);"
" color: #000000;"
" border: 1px solid #323232"
" border-radius: 5px;"
"}"
"QMenuBar::item:selected {"
" background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #a6a6a6, stop:1 #8a8a8a);"
" color: #000000;"
" border: 1px solid #222222"
" border-radius: 5px;"
"}"
"QMenuBar::item:pressed {"
" background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #a6a6a6, stop:1 #8a8a8a);"
" color: #000000;"
" border: 1px solid #222222"
" border-radius: 5px;"
"}"
);
QMenuBar *visibilityMenuBar = new QMenuBar();
visibilityMenuBar->setMinimumWidth(50);
visibilityMenuBar->setStyleSheet(menuStyleSheet);
visibilityMenuBar->addMenu(visibilityMenu);
visibilityMenuBar->addAction(visibilityAct);
// Search control
// Keyword search highlights rows
QLineEdit *searchField = new QLineEdit();
searchField->setMaximumWidth(200);
mainToolBar->addAction(ui_descriptionAction);
mainToolBar->addSeparator();
mainToolBar->addWidget(visibilityMenuBar);
mainToolBar->addSeparator();
mainToolBar->addWidget(searchField);
}