本文整理汇总了C++中QToolBar::toggleViewAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::toggleViewAction方法的具体用法?C++ QToolBar::toggleViewAction怎么用?C++ QToolBar::toggleViewAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::toggleViewAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toggleViewAction
void tst_QToolBar::toggleViewAction()
{
{
QToolBar tb;
QAction *toggleViewAction = tb.toggleViewAction();
QVERIFY(tb.isHidden());
toggleViewAction->trigger();
QVERIFY(!tb.isHidden());
toggleViewAction->trigger();
QVERIFY(tb.isHidden());
}
{
QMainWindow mw;
QToolBar tb(&mw);
mw.addToolBar(&tb);
mw.show();
QAction *toggleViewAction = tb.toggleViewAction();
QVERIFY(!tb.isHidden());
toggleViewAction->trigger();
QVERIFY(tb.isHidden());
toggleViewAction->trigger();
QVERIFY(!tb.isHidden());
toggleViewAction->trigger();
QVERIFY(tb.isHidden());
}
}
示例2: initWithApp
bool ActionManager::initWithApp(IApplication *app)
{
if (!IActionManager::initWithApp(app)) {
return false;
}
insertMenu(ID_MENU_FILE,tr("&File"));
insertMenu(ID_MENU_RECENT,tr("&Recent"));
insertMenu(ID_MENU_EDIT,tr("&Edit"));
insertMenu(ID_MENU_FIND,tr("F&ind"));
m_viewMenu = insertMenu(ID_MENU_VIEW,tr("&View"));
m_viewMenu->addSeparator();
m_baseToolBarAct = m_viewMenu->addSeparator();
m_baseBrowserAct = m_viewMenu->addSeparator();
m_viewMenu->addSeparator();
insertMenu(ID_MENU_TOOLS,tr("&Tools"));
insertMenu(ID_MENU_BUILD,tr("&Build"));
insertMenu(ID_MENU_DEBUG,tr("&Debug"));
insertMenu(ID_MENU_HELP,tr("&Help"));
QToolBar *stdToolBar = insertToolBar(ID_TOOLBAR_STD,tr("Standard Toolbar"));
insertViewMenu(LiteApi::ViewMenuToolBarPos,stdToolBar->toggleViewAction());
return true;
}
示例3: QToolBar
QToolBar *BrowserWindow::createToolBar()
{
QToolBar *navigationBar = new QToolBar(tr("Navigation"));
navigationBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
navigationBar->toggleViewAction()->setEnabled(false);
m_historyBackAction = new QAction(this);
QList<QKeySequence> backShortcuts = QKeySequence::keyBindings(QKeySequence::Back);
for (auto it = backShortcuts.begin(); it != backShortcuts.end();) {
// Chromium already handles navigate on backspace when appropriate.
if ((*it)[0] == Qt::Key_Backspace)
it = backShortcuts.erase(it);
else
++it;
}
// For some reason Qt doesn't bind the dedicated Back key to Back.
backShortcuts.append(QKeySequence(Qt::Key_Back));
m_historyBackAction->setShortcuts(backShortcuts);
m_historyBackAction->setIconVisibleInMenu(false);
m_historyBackAction->setIcon(QIcon(QStringLiteral(":go-previous.png")));
connect(m_historyBackAction, &QAction::triggered, [this]() {
m_tabWidget->triggerWebPageAction(QWebEnginePage::Back);
});
navigationBar->addAction(m_historyBackAction);
m_historyForwardAction = new QAction(this);
QList<QKeySequence> fwdShortcuts = QKeySequence::keyBindings(QKeySequence::Forward);
for (auto it = fwdShortcuts.begin(); it != fwdShortcuts.end();) {
if (((*it)[0] & Qt::Key_unknown) == Qt::Key_Backspace)
it = fwdShortcuts.erase(it);
else
++it;
}
fwdShortcuts.append(QKeySequence(Qt::Key_Forward));
m_historyForwardAction->setShortcuts(fwdShortcuts);
m_historyForwardAction->setIconVisibleInMenu(false);
m_historyForwardAction->setIcon(QIcon(QStringLiteral(":go-next.png")));
connect(m_historyForwardAction, &QAction::triggered, [this]() {
m_tabWidget->triggerWebPageAction(QWebEnginePage::Forward);
});
navigationBar->addAction(m_historyForwardAction);
m_stopReloadAction = new QAction(this);
connect(m_stopReloadAction, &QAction::triggered, [this]() {
m_tabWidget->triggerWebPageAction(QWebEnginePage::WebAction(m_stopReloadAction->data().toInt()));
});
navigationBar->addAction(m_stopReloadAction);
navigationBar->addWidget(m_urlLineEdit);
int size = m_urlLineEdit->sizeHint().height();
navigationBar->setIconSize(QSize(size, size));
return navigationBar;
}
示例4: 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();
}
示例5: initWithApp
bool ActionManager::initWithApp(IApplication *app)
{
if (!IActionManager::initWithApp(app)) {
return false;
}
insertMenu("menu/file",tr("&File"));
insertMenu("menu/recent",tr("&Recent"));
insertMenu("menu/edit",tr("&Edit"));
insertMenu("menu/find",tr("F&ind"));
m_viewMenu = insertMenu("menu/view",tr("&View"));
m_viewToolMenu = m_viewMenu->addMenu(tr("Tool Windows"));
m_viewMenu->addSeparator();
m_baseToolBarAct = m_viewMenu->addSeparator();
m_baseBrowserAct = m_viewMenu->addSeparator();
m_viewMenu->addSeparator();
insertMenu("menu/help",tr("&Help"));
QToolBar *stdToolBar = insertToolBar("toolbar/std",tr("Standard Toolbar"));
insertViewMenu(LiteApi::ViewMenuToolBarPos,stdToolBar->toggleViewAction());
return true;
}
示例6: appIcon
//.........这里部分代码省略.........
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()));
if (m_cmdLine->enableRemoteControl())
示例7: init
//.........这里部分代码省略.........
SLOT(slotShowSelectionContextMenu(const QPoint&, Selection&)));
// Set up the browser tabs
tabWidget->addTab(solarSystemBrowser, _("Solar System"));
tabWidget->addTab(celestialBrowser, _("Stars"));
tabWidget->addTab(deepSkyBrowser, _("Deep Sky Objects"));
toolsDock->setWidget(tabWidget);
addDockWidget(Qt::LeftDockWidgetArea, toolsDock);
infoPanel = new InfoPanel(_("Info Browser"), this);
infoPanel->setObjectName("info-panel");
infoPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, infoPanel);
infoPanel->setVisible(false);
eventFinder = new EventFinder(m_appCore, _("Event Finder"), this);
eventFinder->setObjectName("event-finder");
eventFinder->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
addDockWidget(Qt::LeftDockWidgetArea, eventFinder);
eventFinder->setVisible(false);
//addDockWidget(Qt::DockWidgetArea, eventFinder);
// Create the time toolbar
TimeToolBar* timeToolBar = new TimeToolBar(m_appCore, _("Time"));
timeToolBar->setObjectName("time-toolbar");
timeToolBar->setFloatable(true);
timeToolBar->setMovable(true);
addToolBar(Qt::TopToolBarArea, timeToolBar);
// Create the guides toolbar
QToolBar* guidesToolBar = new QToolBar(_("Guides"));
guidesToolBar->setObjectName("guides-toolbar");
guidesToolBar->setFloatable(true);
guidesToolBar->setMovable(true);
guidesToolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);
guidesToolBar->addAction(actions->equatorialGridAction);
guidesToolBar->addAction(actions->galacticGridAction);
guidesToolBar->addAction(actions->eclipticGridAction);
guidesToolBar->addAction(actions->horizonGridAction);
guidesToolBar->addAction(actions->eclipticAction);
guidesToolBar->addAction(actions->markersAction);
guidesToolBar->addAction(actions->constellationsAction);
guidesToolBar->addAction(actions->boundariesAction);
guidesToolBar->addAction(actions->orbitsAction);
guidesToolBar->addAction(actions->labelsAction);
addToolBar(Qt::TopToolBarArea, guidesToolBar);
// Give keyboard focus to the 3D view
glWidget->setFocus();
m_bookmarkManager = new BookmarkManager(this);
// Load the bookmarks file and nitialize the bookmarks menu
if (!loadBookmarks())
m_bookmarkManager->initializeBookmarks();
populateBookmarkMenu();
connect(m_bookmarkManager, SIGNAL(bookmarkTriggered(const QString&)),
this, SLOT(slotBookmarkTriggered(const QString&)));
m_bookmarkToolBar = new BookmarkToolBar(m_bookmarkManager, this);
m_bookmarkToolBar->setObjectName("bookmark-toolbar");
m_bookmarkToolBar->rebuild();
addToolBar(Qt::TopToolBarArea, m_bookmarkToolBar);
// Read saved window preferences
readSettings();
// Build the view menu
// Add dockable panels and toolbars to the view menu
viewMenu->addAction(timeToolBar->toggleViewAction());
viewMenu->addAction(guidesToolBar->toggleViewAction());
viewMenu->addAction(m_bookmarkToolBar->toggleViewAction());
viewMenu->addSeparator();
viewMenu->addAction(toolsDock->toggleViewAction());
viewMenu->addAction(infoPanel->toggleViewAction());
viewMenu->addAction(eventFinder->toggleViewAction());
viewMenu->addSeparator();
QAction* fullScreenAction = new QAction(_("Full screen"), this);
fullScreenAction->setCheckable(true);
fullScreenAction->setShortcut(QString(_("Shift+F11")));
// Set the full screen check state only after reading settings
fullScreenAction->setChecked(isFullScreen());
connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(slotToggleFullScreen()));
viewMenu->addAction(fullScreenAction);
// We use a timer with a null timeout value
// to add m_appCore->tick to Qt's event loop
QTimer *t = new QTimer(dynamic_cast<QObject *>(this));
QObject::connect(t, SIGNAL(timeout()), SLOT(celestia_tick()));
t->start(0);
}
示例8: show
void Mainframe::show()
{
// prevent multiple inserting of menu entries, by calls of showFullScreen(), ...
if (preferences_action_ != 0)
{
MainControl::show();
return;
}
QToolBar* tb = NULL;
if (UIOperationMode::instance().getMode() <= UIOperationMode::MODE_ADVANCED)
{
tb = new QToolBar("Main Toolbar", this);
tb->setObjectName("Main Toolbar");
tb->setIconSize(QSize(22,22));
addToolBar(Qt::TopToolBarArea, tb);
}
MainControl::show();
QMenu *menu = initPopupMenu(MainControl::WINDOWS, UIOperationMode::MODE_ADVANCED);
if (menu)
{
menu->addSeparator();
menu->addAction(tb->toggleViewAction());
}
// NOTE: this *has* to be run... a null pointer is unproblematic
if (UIOperationMode::instance().getMode() <= UIOperationMode::MODE_ADVANCED)
{
MolecularFileDialog::getInstance(0)->addToolBarEntries(tb);
DownloadPDBFile::getInstance(0)->addToolBarEntries(tb);
DownloadElectronDensity::getInstance(0)->addToolBarEntries(tb);
PubChemDialog::getInstance(0)->addToolBarEntries(tb);
UndoManagerDialog::getInstance(0)->addToolBarEntries(tb);
tb->addAction(fullscreen_action_);
Path path;
IconLoader& loader = IconLoader::instance();
qload_action_ = new QAction(loader.getIcon("actions/quickopen-file"), tr("quickload"), this);
qload_action_->setObjectName("quickload");
connect(qload_action_, SIGNAL(triggered()), this, SLOT(quickLoadConfirm()));
HelpViewer::getInstance("BALLView Docu")->registerForHelpSystem(qload_action_, "tips.html#quickload");
tb->addAction(qload_action_);
qsave_action_ = new QAction(loader.getIcon("actions/quicksave"), tr("quicksave"), this);
qsave_action_->setObjectName("quicksave");
connect(qsave_action_, SIGNAL(triggered()), this, SLOT(quickSave()));
HelpViewer::getInstance("BALLView Docu")->registerForHelpSystem(qsave_action_, "tips.html#quickload");
tb->addAction(qsave_action_);
tb->addSeparator();
DisplayProperties::getInstance(0)->addToolBarEntries(tb);
MolecularStructure::getInstance(0)->addToolBarEntries(tb);
}
scene_->addToolBarEntries(tb);
if (UIOperationMode::instance().getMode() <= UIOperationMode::MODE_ADVANCED)
{
tb->addAction(stop_simulation_action_);
tb->addAction(preferences_action_);
HelpViewer::getInstance("BALLView Docu")->addToolBarEntries(tb);
}
// we have changed the child widgets stored in the maincontrol (e.g. toolbars), so we have
// to restore the window state again!
restoreWindows();
}
示例9: QMainWindow
//.........这里部分代码省略.........
// Construct Select tool bar.
QToolBar* selectToolBar = addToolBar("Select Tool bar");
selectToolBar->setObjectName("Select QToolBar");
selectToolBar->layout()->setSpacing(spacing);
selectToolBar->addWidget(new QLabel("Montage:", this));
montageComboBox = new QComboBox(this);
montageComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
montageComboBox->setMaximumWidth(200);
selectToolBar->addWidget(montageComboBox);
selectToolBar->addWidget(new QLabel("Event Type:", this));
eventTypeComboBox = new QComboBox(this);
eventTypeComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
eventTypeComboBox->setMaximumWidth(200);
selectToolBar->addWidget(eventTypeComboBox);
// Construct Zoom tool bar.
QToolBar* zoomToolBar = addToolBar("Zoom Tool Bar");
zoomToolBar->setObjectName("Zoom QToolBar");
zoomToolBar->layout()->setSpacing(spacing);
zoomToolBar->addAction(horizontalZoomInAction);
zoomToolBar->addAction(horizontalZoomOutAction);
zoomToolBar->addAction(verticalZoomInAction);
zoomToolBar->addAction(verticalZoomOutAction);
// Construct File menu.
QMenu* fileMenu = menuBar()->addMenu("&File");
fileMenu->addAction(openFileAction);
fileMenu->addAction(closeFileAction);
fileMenu->addAction(saveFileAction);
// Construct View menu.
QMenu* viewMenu = menuBar()->addMenu("&View");
viewMenu->addAction(horizontalZoomInAction);
viewMenu->addAction(horizontalZoomOutAction);
viewMenu->addAction(verticalZoomInAction);
viewMenu->addAction(verticalZoomOutAction);
QMenu* timeModeMenu = new QMenu("Time Mode", this);
timeModeMenu->addAction(timeModeAction0);
timeModeMenu->addAction(timeModeAction1);
timeModeMenu->addAction(timeModeAction2);
viewMenu->addMenu(timeModeMenu);
QMenu* timeLineIntervalMenu = new QMenu("Time Line Interval", this);
timeLineIntervalMenu->addAction(timeLineOffAction);
timeLineIntervalMenu->addAction(setTimeLineIntervalAction);
viewMenu->addMenu(timeLineIntervalMenu);
// Construct Window menu.
QMenu* windowMenu = menuBar()->addMenu("&Window");
windowMenu->addAction(trackManagerDockWidget->toggleViewAction());
windowMenu->addAction(eventManagerDockWidget->toggleViewAction());
windowMenu->addAction(eventTypeDockWidget->toggleViewAction());
windowMenu->addAction(montageManagerDockWidget->toggleViewAction());
windowMenu->addSeparator();
windowMenu->addAction(fileToolBar->toggleViewAction());
windowMenu->addAction(filterToolBar->toggleViewAction());
windowMenu->addAction(selectToolBar->toggleViewAction());
windowMenu->addAction(zoomToolBar->toggleViewAction());
// Construct status bar.
timeModeStatusLabel = new QLabel(this);
timeModeStatusLabel->setContextMenuPolicy(Qt::ActionsContextMenu);
timeModeStatusLabel->addAction(timeModeAction0);
timeModeStatusLabel->addAction(timeModeAction1);
timeModeStatusLabel->addAction(timeModeAction2);
statusBar()->addPermanentWidget(timeModeStatusLabel);
timeStatusLabel = new QLabel(this);
timeStatusLabel->setContextMenuPolicy(Qt::ActionsContextMenu);
timeStatusLabel->addAction(timeModeAction0);
timeStatusLabel->addAction(timeModeAction1);
timeStatusLabel->addAction(timeModeAction2);
statusBar()->addPermanentWidget(timeStatusLabel);
positionStatusLabel = new QLabel(this);
positionStatusLabel->setContextMenuPolicy(Qt::ActionsContextMenu);
positionStatusLabel->addAction(timeModeAction0);
positionStatusLabel->addAction(timeModeAction1);
positionStatusLabel->addAction(timeModeAction2);
statusBar()->addPermanentWidget(positionStatusLabel);
cursorStatusLabel = new QLabel(this);
cursorStatusLabel->setContextMenuPolicy(Qt::ActionsContextMenu);
cursorStatusLabel->addAction(timeModeAction0);
cursorStatusLabel->addAction(timeModeAction1);
cursorStatusLabel->addAction(timeModeAction2);
statusBar()->addPermanentWidget(cursorStatusLabel);
// Restore settings.
restoreGeometry(PROGRAM_OPTIONS.settings("SignalFileBrowserWindow geometry").toByteArray());
restoreState(PROGRAM_OPTIONS.settings("SignalFileBrowserWindow state").toByteArray());
}