HelpDialog::HelpDialog( QWidget* parent) : QDialog( parent ) { QVBoxLayout* layout = new QVBoxLayout; setLayout( layout ); QTextBrowser* webView = new QTextBrowser( this ); layout->addWidget( webView ); const QString text = tr( "<h3>Presentation</h3> \ This application demonstrates some aspects of the KDAB updater component.<br/> \ Initially you can add target items (<a href=#L4RAction>Line 4 Receiver</a> or <a href=#PSMAction>PSM</a> devices) that use some current firmware version, to the table. <br/> \ You can see the current compatibility level and firmware version known to the application in the status bar. The source used for finding updates is available when clicking on the button <a href=#SourcesAction>Update Sources</a>.\ <h3>Step 1: add some items</h3> \ Add some items to the table, using the <a href=#L4RAction>Add Line 4 Receiver</a> or <a href=#PSMAction>Add PSM</a> button. \ <h3>Step 2: update the firmware</h3> \ Update the firmware information by clicking on the <a href=#UpdateAction>Update</a> button : a dialog appears that lets you download and install the version <b>1.1</b> for the package <b>Firmware</b>.<br/> \ Once that is done, the status bar is updated with the new firmware version.<br/> \ To update the devices in the table: <a href=#SelectAllAction>select them all</a> and click on the <a href=#UploadAction>Upload Firmwares</a> button. \ <h3>Step 3: change the compatibility level</h3> \ The current compatibility level is <b>1</b>. To change that, click on the <a href=#CompatUpdateAction>Update Compat</a> button : a dialog appears that lets you change to a new compat level <b>2</b>, if updates at that level are available.<br/>\ Once it's done, the status bar is updated with the new compat level and you should see a new column in the table and the application's style changed.\ <h3>Step 4: update the firmware (one more time)</h3> \ Now that you changed the compatibility level, you can update the firmware one more time by clicking on the <a href=#UpdateAction>Update</a> button: a dialog appears that lets you install the version <b>2.0</b> for the package <b>Firmware</b><br/> \ This update wasn't available the first time because it needs the compatibility level <b>2</b>." ); webView->setHtml( text ); connect( webView, SIGNAL(linkClicked(QUrl)), this, SLOT(clickLink(QUrl)) ); setWindowTitle( tr("Help FirmwareDemoHttp") ); resize( 480, 480 ); }
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); bar = new LocationBar(this); QHBoxLayout *downLayout = new QHBoxLayout; downLayout->addWidget(ui->pushButBkmrk); downLayout->addWidget(ui->pushButton); downLayout->addStretch(); //QWebView *webView = new QWebView; QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(bar); layout->addWidget(ui->webView); layout->addLayout(downLayout); this->setLayout(layout); refreshUrl(); clickLink(); ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); readData(); //读取数据 createActions(); //创建浏览器按钮动作 createMenuBar(); ui->pushButBkmrk->setMenu(pFavorite); QSettings a ("a.ini",QSettings::IniFormat); a.beginGroup("a"); //a.setValue("a","a"); //a.setValue("b","b"); a.endGroup(); }
MainWindow::MainWindow(const QUrl& url) { progress = 0; QFile file; file.setFileName(":/jquery.min.js"); file.open(QIODevice::ReadOnly); jQuery = file.readAll(); jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };"); file.close(); //! [1] QNetworkProxyFactory::setUseSystemConfiguration(true); //! [2] view = new QWebView(this); view->load(url); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); locationEdit = new QLineEdit(this); locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy()); connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); QToolBar *toolBar = addToolBar(tr("导航")); toolBar->addAction(view->pageAction(QWebPage::Back)); toolBar->addAction(view->pageAction(QWebPage::Forward)); toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); //! [2] QMenu *fileMenu = menuBar()->addMenu(tr("文件(&F)")); QAction *newWindowAction = new QAction(tr("新建窗口"),this); connect(newWindowAction, SIGNAL(triggered()),SLOT(newWindow())); fileMenu->addAction(newWindowAction); QAction *closeWindowAction = new QAction(tr("关闭窗口"),this); connect(closeWindowAction, SIGNAL(triggered()),SLOT(closeWindow())); fileMenu->addAction(closeWindowAction); QMenu *viewMenu = menuBar()->addMenu(tr("查看(&V)")); QAction* viewSourceAction = new QAction(tr("页面源代码"), this); connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource())); viewMenu->addAction(view->pageAction(QWebPage::Stop)); viewMenu->addAction(view->pageAction(QWebPage::Reload)); viewMenu->addSeparator(); viewMenu->addAction(viewSourceAction); //! [3] QMenu *historyMenu = menuBar()->addMenu(tr("历史(&H)")); historyMenu->addAction(view->pageAction(QWebPage::Back)); historyMenu->addAction(view->pageAction(QWebPage::Forward)); QMenu *effectMenu = menuBar()->addMenu(tr("效果(&E)")); effectMenu->addAction(tr("高亮所有链接"), this, SLOT(highlightAllLinks())); rotateAction = new QAction(this); rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView)); rotateAction->setCheckable(true); rotateAction->setText(tr("倒转图像")); connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool))); effectMenu->addAction(rotateAction); QMenu *toolsMenu = menuBar()->addMenu(tr("工具(&T)")); toolsMenu->addAction(tr("移除 GIF 动画"), this, SLOT(removeGifImages())); toolsMenu->addAction(tr("移除所有内联框架"), this, SLOT(removeInlineFrames())); toolsMenu->addAction(tr("移除所有对象元素"), this, SLOT(removeObjectElements())); toolsMenu->addAction(tr("移除所有嵌入元素"), this, SLOT(removeEmbeddedElements())); QMenu *helpMenu = menuBar()->addMenu(tr("帮助(&H)")); helpMenu->addAction(tr("关于 Looplorer"), this, SLOT(aboutLooplorer())); setCentralWidget(view); setUnifiedTitleAndToolBarOnMac(true); view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); clickLink(); windowNum++; }