本文整理汇总了C++中QToolBar::windowTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::windowTitle方法的具体用法?C++ QToolBar::windowTitle怎么用?C++ QToolBar::windowTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::windowTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createToolBars
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::createToolBars()
{
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT(cmdFeatureMgr);
QStringList toolbarNames;
toolbarNames << "Standard"
<< "Window Management"
<< "View Snapshots"
<< "View";
for (QString toolbarName : toolbarNames)
{
QToolBar* toolbar = addToolBar(toolbarName);
toolbar->setObjectName(toolbar->windowTitle());
QStringList toolbarCommands = toolbarCommandIds(toolbarName);
for (QString s : toolbarCommands)
{
toolbar->addAction(cmdFeatureMgr->action(s));
}
}
m_wellLogPlotToolBarEditor = new caf::PdmUiToolBarEditor("Well Log Plot", this);
m_wellLogPlotToolBarEditor->hide();
m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor("Summary Plot", this);
m_summaryPlotToolBarEditor->hide();
}
示例2: QDialog
ToolbarDialog::ToolbarDialog(QWidget* parent)
: QDialog(parent),m_defaultToolBars()
{
setupUi(this);
createDefaultToolBars();
// populate all available actions
QList<QAction*> actions = parent->findChildren<QAction*>(QRegExp("action*"));
QAction* action;
foreach(action, actions) {
if (action->actionGroup()->objectName() != "extraGroup")
continue;
QListWidgetItem* item = new QListWidgetItem(action->toolTip());
item->setIcon(action->icon());
item->setData(Qt::UserRole, QVariant::fromValue((QObject*)action));
listAllActions->addItem(item);
}
// Important to add special Separator
listAllActions->addItem("Separator");
QList<QToolBar*> toolbars = parent->findChildren<QToolBar*>();
QToolBar* toolbar = NULL;
int index = 0;
foreach(toolbar, toolbars) {
index = (int)(toolbar->iconSize().height()/10)-1;
if (toolbar->objectName() != "keyToolBar")
comboToolbars->addItem(toolbar->windowTitle(), QVariant::fromValue((QObject*)toolbar));
}
示例3: setup
void ToolBoxManager::setup( ToolBarItem* toolBar ) const
{
if ( !toolBar || !_toolBox )
return; // empty tool bar
int ct = _toolBox->count();
for ( int i=0; i<ct; i++ )
{
// get always the first item widget
QWidget* w = _toolBox->widget(0);
_toolBox->removeItem(0);
delete w;
}
CommandManager& mgr = Application::Instance->commandManager();
QList<ToolBarItem*> items = toolBar->getItems();
for ( QList<ToolBarItem*>::ConstIterator item = items.begin(); item != items.end(); ++item )
{
QToolBar* bar = new QToolBar();
bar->setOrientation(Qt::Vertical);
bar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
std::string toolbarName = (*item)->command();
bar->setObjectName(QString::fromLatin1((*item)->command().c_str()));
bar->setWindowTitle(QObject::trUtf8(toolbarName.c_str())); // i18n
_toolBox->addItem( bar, bar->windowTitle() );
QList<ToolBarItem*> subitems = (*item)->getItems();
for ( QList<ToolBarItem*>::ConstIterator subitem = subitems.begin(); subitem != subitems.end(); ++subitem )
{
if ( (*subitem)->command() == "Separator" ) {
//bar->addSeparator();
} else {
mgr.addTo((*subitem)->command().c_str(), bar);
}
}
// Now set the right size policy for each tool button
QList<QToolButton*> tool = bar->findChildren<QToolButton*>();
for (QList<QToolButton*>::Iterator it = tool.begin(); it != tool.end(); ++it) {
(*it)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// When setting the horizontal size policy but no icon is set we use the following trick
// to make the button text left aligned.
QIcon icon = (*it)->icon();
if (icon.isNull())
{
// Create an icon filled with the button color
int size = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap p(size, size);
p.fill(Qt::transparent);
(*it)->setIcon(p);
}
}
}
}