当前位置: 首页>>代码示例>>C++>>正文


C++ QMenuBar::setMinimumWidth方法代码示例

本文整理汇总了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);
}
开发者ID:banduladh,项目名称:levelfour,代码行数:79,代码来源:TableViewPanel.cpp


注:本文中的QMenuBar::setMinimumWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。