本文整理汇总了C++中QToolBar::hide方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::hide方法的具体用法?C++ QToolBar::hide怎么用?C++ QToolBar::hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::hide方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visibilityChanged
void tst_QToolBar::visibilityChanged()
{
QMainWindow mw;
QToolBar tb;
QSignalSpy spy(&tb, SIGNAL(visibilityChanged(bool)));
mw.addToolBar(&tb);
mw.show();
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), true);
spy.clear();
tb.hide();
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), false);
spy.clear();
tb.hide();
QCOMPARE(spy.count(), 0);
tb.show();
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), true);
spy.clear();
tb.show();
QCOMPARE(spy.count(), 0);
}
示例2: clearInterface
//==============================================================
void TulipApp::clearInterface() {
//Dock widgets
QObjectList objectList=this->children();
for(QObjectList::iterator it=objectList.begin(); it!=objectList.end(); ++it) {
QDockWidget *widget=dynamic_cast<QDockWidget *>(*it);
if(widget) {
removeDockWidget(widget);
widget->hide();
}
QToolBar *tb = dynamic_cast<QToolBar *>(*it);
if (tb && tb != toolBar && tb != graphToolBar) {
removeToolBar(tb);
tb->hide();
tb->setParent(0);
}
}
menuBar()->clear();
toolBar->clear();
graphToolBar->clear();
}
示例3: eventFilter
bool MWToolBarManagerImpl::eventFilter(QObject *obj, QEvent *event) {
QEvent::Type t = event->type();
if (t == QEvent::ActionAdded || t == QEvent::ActionRemoved) {
#ifdef Q_OS_WIN
// mega-hack -> update all the area below toolbar by extra show()/hide() for .NET style
// if OpenGL widget present (-> WA_NativeWindow is set)
// if not done .NET style will leave artifacts on toolbar
QToolBar* tb = qobject_cast<QToolBar*>(obj);
tb->hide();
#endif
updateToolbarVisibilty();
}
return QObject::eventFilter(obj, event);
}
示例4: assert
void
ViewerTab::removeRotoInterface(NodeGui* n,
bool permanently,
bool removeAndDontSetAnother)
{
std::map<NodeGui*,RotoGui*>::iterator it = _imp->rotoNodes.find(n);
if ( it != _imp->rotoNodes.end() ) {
if (_imp->currentRoto.first == n) {
QObject::disconnect( _imp->currentRoto.second,SIGNAL(roleChanged(int,int)),this,SLOT(onRotoRoleChanged(int,int)) );
///Remove the widgets of the current roto node
assert(_imp->viewerLayout->count() > 1);
QLayoutItem* currentToolBarItem = _imp->viewerLayout->itemAt(0);
QToolBar* currentToolBar = qobject_cast<QToolBar*>( currentToolBarItem->widget() );
currentToolBar->hide();
assert( currentToolBar == _imp->currentRoto.second->getToolBar() );
_imp->viewerLayout->removeItem(currentToolBarItem);
int buttonsBarIndex = _imp->mainLayout->indexOf( _imp->currentRoto.second->getCurrentButtonsBar() );
assert(buttonsBarIndex >= 0);
QLayoutItem* buttonsBar = _imp->mainLayout->itemAt(buttonsBarIndex);
assert(buttonsBar);
_imp->mainLayout->removeItem(buttonsBar);
buttonsBar->widget()->hide();
if (!removeAndDontSetAnother) {
///If theres another roto node, set it as the current roto interface
std::map<NodeGui*,RotoGui*>::iterator newRoto = _imp->rotoNodes.end();
for (std::map<NodeGui*,RotoGui*>::iterator it2 = _imp->rotoNodes.begin(); it2 != _imp->rotoNodes.end(); ++it2) {
if ( (it2->second != it->second) && it2->first->isSettingsPanelVisible() ) {
newRoto = it2;
break;
}
}
_imp->currentRoto.first = 0;
_imp->currentRoto.second = 0;
if ( newRoto != _imp->rotoNodes.end() ) {
setRotoInterface(newRoto->first);
}
}
}
if (permanently) {
delete it->second;
_imp->rotoNodes.erase(it);
}
}
示例5: QMainWindow
WebViewWindow::WebViewWindow(QWidget *parent) :
QMainWindow(parent)
{
QAction* reloadAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_BrowserReload), tr("Reload"), this);
reloadAction->setShortcut(QKeySequence(QKeySequence::Refresh));
QToolBar* toolBar = new QToolBar(tr("ToolBar"), this);
mAddressBar = new QLineEdit(toolBar);
mAddressBar->setReadOnly(true);
toolBar->addWidget(mAddressBar);
toolBar->addAction(reloadAction);
toolBar->setMovable(false);
toolBar->hide();
toolBar->installEventFilter(this);
mToolBar = toolBar;
addToolBar(toolBar);
QMenuBar* menuBar = this->menuBar();
QMenu* fileMenu = menuBar->addMenu(tr("&File"));
fileMenu->addAction(reloadAction);
QAction* quitAction = fileMenu->addAction(QIcon(":/media/application_exit.png"), tr("Quit"));
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
QMenu* viewMenu = menuBar->addMenu(tr("&View"));
viewMenu->addAction(toolBar->toggleViewAction());
QMenu* debugMenu = menuBar->addMenu(tr("&Debug"));
QAction* inspectAction = debugMenu->addAction(tr("Inspect"));
connect(inspectAction, SIGNAL(triggered()), this, SLOT(showWebInspector()));
mWebView = new QWebView(this);
mWebInspector = 0;
QWebSettings* webSettings = mWebView->settings();
webSettings->setAttribute(QWebSettings::LocalStorageEnabled, true);
webSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWidget* centralWidget = new QWidget(this);
QVBoxLayout* layout = new QVBoxLayout(centralWidget);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mWebView);
layout->setAlignment(mWebView, Qt::AlignCenter);
setCentralWidget(centralWidget);
setWindowModality(Qt::WindowModal);
connect(reloadAction, SIGNAL(triggered()), mWebView, SLOT(reload()));
loadWebInspector();
}
示例6: appIcon
//.........这里部分代码省略.........
connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));
QString defWindowTitle = tr("Qt Assistant");
setWindowTitle(defWindowTitle);
setupActions();
statusBar()->show();
m_centralWidget->connectTabBar();
setupFilterToolbar();
setupAddressToolbar();
const QString windowTitle = helpEngineWrapper.windowTitle();
setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle);
QByteArray iconArray = helpEngineWrapper.applicationIcon();
if (iconArray.size() > 0) {
QPixmap pix;
pix.loadFromData(iconArray);
QIcon appIcon(pix);
qApp->setWindowIcon(appIcon);
} else {
QIcon appIcon(QLatin1String(":/trolltech/assistant/images/assistant-128.png"));
qApp->setWindowIcon(appIcon);
}
QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar"));
toolBar->setObjectName(QLatin1String("Bookmark Toolbar"));
bookMarkManager->setBookmarksToolbar(toolBar);
// Show the widget here, otherwise the restore geometry and state won't work
// on x11.
show();
toolBar->hide();
toolBarMenu()->addAction(toolBar->toggleViewAction());
QByteArray ba(helpEngineWrapper.mainWindow());
if (!ba.isEmpty())
restoreState(ba);
ba = helpEngineWrapper.mainWindowGeometry();
if (!ba.isEmpty()) {
restoreGeometry(ba);
} else {
tabifyDockWidget(contentDock, indexDock);
tabifyDockWidget(indexDock, bookmarkDock);
tabifyDockWidget(bookmarkDock, searchDock);
contentDock->raise();
const QRect screen = QApplication::desktop()->screenGeometry();
resize(4*screen.width()/5, 4*screen.height()/5);
}
if (!helpEngineWrapper.hasFontSettings()) {
helpEngineWrapper.setUseAppFont(false);
helpEngineWrapper.setUseBrowserFont(false);
helpEngineWrapper.setAppFont(qApp->font());
helpEngineWrapper.setAppWritingSystem(QFontDatabase::Latin);
helpEngineWrapper.setBrowserFont(qApp->font());
helpEngineWrapper.setBrowserWritingSystem(QFontDatabase::Latin);
} else {
updateApplicationFont();
}
updateAboutMenuText();
QTimer::singleShot(0, this, SLOT(insertLastPages()));
示例7: QToolBar
//.........这里部分代码省略.........
tbar->addSeparator();
tbar->addAction( M_sync_act );
tbar->addAction( M_decrement_act );
tbar->addAction( M_increment_act );
tbar->addSeparator();
QLabel * find_label = new QLabel( tr( "Find: " ) );
M_find_box = new QLineEdit();
M_find_box->setMaximumSize( 100, 48 );
connect( M_find_box, SIGNAL( returnPressed() ),
this, SLOT( findExistString() ) );
connect( M_find_box, SIGNAL( textChanged( const QString & ) ),
this, SLOT( findString( const QString & ) ) );
// invisible action
{
QAction * act = new QAction( tr( "Focus Find Box" ), this );
#ifdef Q_WS_MAC
act->setShortcut( Qt::META + Qt::Key_F );
#else
act->setShortcut( Qt::CTRL + Qt::Key_F );
#endif
connect( act, SIGNAL( triggered() ),
M_find_box, SLOT( setFocus() ) );
}
M_find_forward_rb = new QRadioButton( tr( "Down" ) );
connect( M_find_forward_rb, SIGNAL( clicked() ),
this, SLOT( findExistString() ) );
M_find_backward_rb = new QRadioButton( tr( "Up" ) );
connect( M_find_backward_rb, SIGNAL( clicked() ),
this, SLOT( findExistString() ) );
M_find_forward_rb->setChecked( true );
tbar->addWidget( find_label );
tbar->addWidget( M_find_box );
tbar->addWidget( M_find_forward_rb );
tbar->addWidget( M_find_backward_rb );
{
QFrame * dummy_frame = new QFrame;
QHBoxLayout * layout = new QHBoxLayout;
layout->addSpacing( 10 );
layout->addStretch( 1 );
dummy_frame->setLayout( layout );
tbar->addWidget( dummy_frame );
}
this->addToolBar( Qt::TopToolBarArea, tbar );
}
{
QToolBar * tbar = new QToolBar( tr( "Debug view" ), this );
tbar->setIconSize( QSize( 16, 16 ) );
tbar->addAction( M_show_debug_view_all_act );
tbar->addAction( M_show_debug_view_self_act );
tbar->addAction( M_show_debug_view_ball_act );
tbar->addAction( M_show_debug_view_teammates_act );
tbar->addAction( M_show_debug_view_opponents_act );
tbar->addAction( M_show_debug_view_comment_act );
tbar->addAction( M_show_debug_view_shape_act );
tbar->addAction( M_show_debug_view_target_act );
tbar->addAction( M_show_debug_view_message_act );
tbar->addSeparator();
tbar->addAction( M_show_debug_log_objects_act );
this->addToolBar( Qt::TopToolBarArea, tbar );
}
// left tool bar
{
QToolBar * tbar = new QToolBar( tr( "Debug Level" ), this );
tbar->setIconSize( QSize( 16, 16 ) );
QToolBar * hbar = new QToolBar( tr( "Debug Level Hidden" ), this );
hbar->setIconSize( QSize( 16, 16 ) );
for ( int i = 0; i < 32; ++i )
{
if ( ! M_debug_text[i].isEmpty() )
{
tbar->addAction( M_debug_level_act[i] );
}
else
{
hbar->addAction( M_debug_level_act[i] );
}
}
this->addToolBar( Qt::LeftToolBarArea, tbar );
this->addToolBar( Qt::LeftToolBarArea, hbar );
hbar->hide();
}
}
示例8: dir
GoplayBrowser::GoplayBrowser(LiteApi::IApplication *app, QObject *parent)
: LiteApi::IBrowserEditor(parent),
m_liteApp(app)
{
QDir dir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
dir.mkpath("liteide/goplay");
dir.cd("liteide");
m_dataPath = dir.path()+"/goplay";
m_playFile = QFileInfo(dir,"goplay.go").filePath();
QFile file(m_playFile);
if (file.open(QFile::WriteOnly|QIODevice::Text)) {
file.write(data.toUtf8());
file.close();
}
m_widget = new QWidget;
m_editor = m_liteApp->fileManager()->createEditor(data,"text/x-gosrc");
m_editor->open(m_playFile,"text/x-gosrc");
QToolBar *toolBar = LiteApi::findExtensionObject<QToolBar*>(m_editor,"LiteApi.QToolBar");
if (toolBar) {
toolBar->hide();
}
m_output = new TextOutput;
QVBoxLayout *layout = new QVBoxLayout;
QHBoxLayout *head = new QHBoxLayout;
QSplitter *spliter = new QSplitter(Qt::Vertical);
QLabel *label = new QLabel("<h2>Go Playground</h2>");
QPushButton *run = new QPushButton("Run");
QPushButton *stop = new QPushButton("Stop");
QPushButton *_new = new QPushButton("New");
QPushButton *load = new QPushButton("Load");
QPushButton *save = new QPushButton("Save");
QPushButton *shell = new QPushButton("Explorer");
m_editLabel = new QLabel;
head->addWidget(label);
head->addWidget(run);
head->addWidget(stop);
head->addWidget(_new);
head->addWidget(load);
head->addWidget(save);
head->addWidget(shell);
head->addWidget(m_editLabel);
head->addStretch();
layout->addLayout(head);
spliter->addWidget(m_editor->widget());
spliter->addWidget(m_output);
spliter->setStretchFactor(0,2);
spliter->setStretchFactor(1,1);
layout->addWidget(spliter);
m_widget->setLayout(layout);
m_process = new ProcessEx(this);
m_process->setWorkingDirectory(dir.path());
m_codec = QTextCodec::codecForName("utf-8");
connect(run,SIGNAL(clicked()),this,SLOT(run()));
connect(stop,SIGNAL(clicked()),this,SLOT(stop()));
connect(_new,SIGNAL(clicked()),this,SLOT(newPlay()));
connect(load,SIGNAL(clicked()),this,SLOT(loadPlay()));
connect(save,SIGNAL(clicked()),this,SLOT(savePlay()));
connect(shell,SIGNAL(clicked()),this,SLOT(shell()));
connect(m_process,SIGNAL(started()),this,SLOT(runStarted()));
connect(m_process,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(runOutput(QByteArray,bool)));
connect(m_process,SIGNAL(extFinish(bool,int,QString)),this,SLOT(runFinish(bool,int,QString)));
m_liteApp->extension()->addObject("LiteApi.Goplay",this);
m_liteApp->extension()->addObject("LiteApi.Goplay.IEditor",m_editor);
}
示例9: createPluginHost
//.........这里部分代码省略.........
QObject::connect(bottomButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
mapperCreatePluginHost->setMapping(leftButton, NewSplitterLeft);
mapperCreatePluginHost->setMapping(rightButton, NewSplitterRight);
mapperCreatePluginHost->setMapping(topButton, NewSplitterTop);
mapperCreatePluginHost->setMapping(bottomButton, NewSplitterBottom);
QObject::connect(mapperCreatePluginHost, SIGNAL(mapped(int)), SLOT(createPluginHost(int)));
//load plugin signal:
QObject::connect(addPluginWidgetButton, SIGNAL(clicked()), m_mapperLoadNewPlugin, SLOT(map()));
m_mapperLoadNewPlugin->setMapping(addPluginWidgetButton, pluginHost);
//close plugin host signal:
QObject::connect(closeButton, SIGNAL(clicked()), m_mapperClosePluginHost, SLOT(map()));
m_mapperClosePluginHost->setMapping(closeButton, pluginHost);
//create plugin switch signalmapper
QSignalMapper *mapperSwitchPlugin = new QSignalMapper(pluginHost);
mapperSwitchPlugin->setObjectName("rackPluginSwitchMapper");
QObject::connect(mapperSwitchPlugin, SIGNAL(mapped(QWidget *)), pluginStack, SLOT(setCurrentWidget(QWidget *)));
////test show/hide plugin widget
////QObject::connect(mapperSwitchPlugin, SIGNAL(mapped(QWidget *)), this, SLOT(showHidePluginWidget(QWidget*)));
//////
//create plugin toolbar for mainwindow
QToolBar *pluginToolBar = new QToolBar;
pluginToolBar->setObjectName("rackPluginToolBar");
pluginToolBar->setMovable(false);
pluginToolBar->hide();
addToolBar(Qt::BottomToolBarArea, pluginToolBar);
//store the toolbar pointer as dynamic property to access later when creating plugin toolbar buttons
pluginHost->setProperty("pluginToolBar", qVariantFromValue((QWidget *)pluginToolBar));
//plugin bar signals & slots:
QObject::connect(this, SIGNAL(enterSettingsMode()), pluginToolBar, SLOT(hide()));
QObject::connect(this, SIGNAL(leaveSettingsMode()), pluginToolBar, SLOT(show()));
//insert new pluginhost widget in splitter, create new splitter if necessary
if (position == 0)
{
m_mainSplitter->addWidget(pluginHost);
return;
}
QSignalMapper *sm = qobject_cast<QSignalMapper *>(sender());
QWidget *senderPluginHost = qobject_cast<QWidget *>(sm->mapping(position)->parent()->parent());
RSplitter *parentSplitter = qobject_cast<RSplitter *>(senderPluginHost->parent());
QList<int> widgetsizes;
int senderpos = parentSplitter->indexOf(senderPluginHost);
int newposition;
if ((position == NewSplitterLeft) or (position == NewSplitterTop)) newposition = senderpos;
else newposition = senderpos + 1;
switch (position + parentSplitter->orientation()) { //horizontal=1 vertical=2
case 0: //left horizontal / top vertical
case 2: //right horizontal