void TestWidget::updateJumpList() { QWinJumpList jumplist; if (!m_id.isEmpty()) jumplist.setIdentifier(m_id); const QString applicationBinary = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()); jumplist.recent()->setVisible(ui->cbShowRecent->isChecked()); jumplist.frequent()->setVisible(ui->cbShowFrequent->isChecked()); if (ui->cbRunFullscreen->isChecked()) { QWinJumpListItem *item = new QWinJumpListItem(QWinJumpListItem::Link); item->setTitle(ui->cbRunFullscreen->text()); item->setFilePath(applicationBinary); item->setArguments(QStringList("-fullscreen")); item->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton)); jumplist.tasks()->addItem(item); } if (ui->cbRunFusion->isChecked()) { jumplist.tasks()->addLink(style()->standardIcon(QStyle::SP_DesktopIcon), ui->cbRunFusion->text(), applicationBinary, (QStringList() << "-style" << "fusion")); } if (ui->cbRunText->isChecked()) { jumplist.tasks()->addSeparator(); jumplist.tasks()->addLink(ui->cbRunText->text(), applicationBinary, QStringList("-text")); } jumplist.tasks()->setVisible(!jumplist.tasks()->isEmpty()); }
void MainWindow::initializeApp() { // inform us when a link in the table of contents or preview view is clicked ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); ui->tocWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); // show custom context menu for HTML preview // most actions don't work and can even lead to crashes (like reload) ui->webView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->webView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(webViewContextMenu(QPoint))); // set default style styleDefault(); ui->plainTextEdit->tabWidthChanged(options->tabWidth()); // init extension flags ui->actionAutolink->setChecked(options->isAutolinkEnabled()); ui->actionStrikethroughOption->setChecked(options->isStrikethroughEnabled()); ui->actionAlphabeticLists->setChecked(options->isAlphabeticListsEnabled()); ui->actionDefinitionLists->setChecked(options->isDefinitionListsEnabled()); ui->actionSmartyPants->setChecked(options->isSmartyPantsEnabled()); ui->actionFootnotes->setChecked(options->isFootnotesEnabled()); ui->actionSuperscript->setChecked(options->isSuperscriptEnabled()); // init option flags ui->actionMathSupport->setChecked(options->isMathSupportEnabled()); ui->actionCodeHighlighting->setChecked(options->isCodeHighlightingEnabled()); ui->actionShowSpecialCharacters->setChecked(options->isShowSpecialCharactersEnabled()); ui->actionWordWrap->setChecked(options->isWordWrapEnabled()); ui->actionCheckSpelling->setChecked(options->isSpellingCheckEnabled()); ui->plainTextEdit->setSpellingCheckEnabled(options->isSpellingCheckEnabled()); // set url to markdown syntax help ui->webView_2->setUrl(tr("qrc:/syntax.html")); // allow loading of remote javascript QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); // setup disk cache for network access QString cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); diskCache->setCacheDirectory(cacheDir); ui->webView->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); QWebInspector *inspector = new QWebInspector(); inspector->setPage(ui->webView->page()); loadCustomStyles(); ui->menuLanguages->loadDictionaries(options->dictionaryLanguage()); //: path to built-in snippets resource. JsonSnippetFile::load(tr(":/markdown-snippets.json"), snippetCollection); QString path = DataLocation::writableLocation(); JsonSnippetFile::load(path + "/user-snippets.json", snippetCollection); // setup file explorer connect(ui->fileExplorerDockContents, SIGNAL(fileSelected(QString)), this, SLOT(openRecentFile(QString))); // setup jump list on windows #ifdef Q_OS_WIN QWinJumpList jumplist; jumplist.recent()->setVisible(true); #endif // load file passed to application on start if (!fileName.isEmpty()) { load(fileName); } }
//! [4] void MusicPlayer::createJumpList() { QWinJumpList jumplist; jumplist.recent()->setVisible(true); }