本文整理汇总了C++中QToolBar::installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::installEventFilter方法的具体用法?C++ QToolBar::installEventFilter怎么用?C++ QToolBar::installEventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::installEventFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}