QFont HelpWebView::viewerFont() const { //if (m_HelpEngine.usesBrowserFont()) // return m_HelpEngine.browserFont(); QWebSettings *webSettings = QWebSettings::globalSettings(); return QFont(webSettings->fontFamily(QWebSettings::StandardFont), webSettings->fontSize(QWebSettings::DefaultFontSize)); }
void BrowserApplication::loadSettings() { QSettings settings; settings.beginGroup(QLatin1String("websettings")); QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); QFont standardFont = QFont(standardFontFamily, standardFontSize); standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); QFont fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); defaultSettings->setUserStyleSheetUrl(url); settings.endGroup(); }
void BrowserApplication::loadSettings() { QSettings settings; settings.beginGroup(QLatin1String("websettings")); QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); QFont standardFont = QFont(standardFontFamily, standardFontSize); standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); int minimumFontSize = settings.value(QLatin1String("minimumFontSize"), defaultSettings->fontSize(QWebSettings::MinimumFontSize)).toInt(); defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); QFont fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, !(settings.value(QLatin1String("blockPopupWindows"), true).toBool())); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); defaultSettings->setAttribute(QWebSettings::AutoLoadImages, settings.value(QLatin1String("enableImages"), true).toBool()); defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, settings.value(QLatin1String("enableInspector"), false).toBool()); QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); defaultSettings->setUserStyleSheetUrl(url); settings.endGroup(); }
void SettingsDialog::loadDefaults() { QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); m_standardFont = QFont(standardFontFamily, standardFontSize); standardLabel->setText(QString(QLatin1String("%1 %2")).arg(m_standardFont.family()).arg(m_standardFont.pointSize())); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); m_fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(m_fixedFont.family()).arg(m_fixedFont.pointSize())); downloadsLocation->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); blockPopupWindows->setChecked(!defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows)); enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled)); enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled)); enableImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages)); enableLocalStorage->setChecked(defaultSettings->testAttribute(QWebSettings::LocalStorageEnabled)); clickToFlash->setChecked(false); cookieSessionCombo->setCurrentIndex(0); filterTrackingCookiesCheckbox->setChecked(false); autoFillPasswordFormsCheckBox->setChecked(false); minimFontSizeCheckBox->setChecked(false); minimumFontSizeSpinBox->setValue(9); }
bool ZoomEventFilter::eventFilter (QObject *viewObj, QEvent *someEvent) { if (someEvent->type () != QEvent::Wheel) return false; QWheelEvent *e = static_cast<QWheelEvent*> (someEvent); if (!(e->modifiers () & Qt::ControlModifier)) return false; int degrees = e->delta () / 8; int steps = static_cast<qreal> (degrees) / 15; QWebView *view = qobject_cast<QWebView*> (viewObj); if (e->modifiers () & Qt::ShiftModifier) { auto multiplier = view->textSizeMultiplier (); multiplier += steps * 0.1; view->setTextSizeMultiplier (multiplier); } else { QWebSettings *settings = view->settings (); settings->setFontSize (QWebSettings::DefaultFontSize, std::max (6, settings->fontSize (QWebSettings::DefaultFontSize) + steps)); auto frame = view->page ()->mainFrame (); frame->evaluateJavaScript ("setTimeout(ScrollToBottom,0);"); } return true; }
GeneralSettingsPage::GeneralSettingsPage() { m_font = qApp->font(); #if !defined(QT_NO_WEBKIT) QWebSettings* webSettings = QWebSettings::globalSettings(); m_font.setPointSize(webSettings->fontSize(QWebSettings::DefaultFontSize)); #endif }
QFont HelpViewer::viewerFont() const { QWebSettings* webSettings = QWebSettings::globalSettings(); QFont font(QApplication::font().family(), webSettings->fontSize(QWebSettings::DefaultFontSize)); const QHelpEngineCore &engine = LocalHelpManager::helpEngine(); return qvariant_cast<QFont>(engine.customValue(QLatin1String("font"), font)); }
void SettingsDialog::loadDefaults() { QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); standardFont = QFont(standardFontFamily, standardFontSize); standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize())); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize())); downloadsLocation->setText(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled)); enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled)); }
void SettingsDialog::loadDefaults() { QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); standardFont = QFont(standardFontFamily, standardFontSize); standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize())); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize())); downloadsLocation->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); blockPopupWindows->setChecked(!defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows)); enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled)); enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled)); enableImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages)); clickToFlash->setChecked(true); }
GeneralSettingsPage::GeneralSettingsPage() : m_ui(0) { m_font = qApp->font(); #if !defined(QT_NO_WEBKIT) QWebSettings* webSettings = QWebSettings::globalSettings(); m_font.setPointSize(webSettings->fontSize(QWebSettings::DefaultFontSize)); #endif setId("A.General settings"); setDisplayName(tr("General")); setCategory(Help::Constants::HELP_CATEGORY); setDisplayCategory(QCoreApplication::translate("Help", Help::Constants::HELP_TR_CATEGORY)); setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON)); }
QFont QtWebKitHelpViewer::viewerFont() const { QWebSettings* webSettings = m_webView->settings(); return QFont(webSettings->fontFamily(QWebSettings::StandardFont), webSettings->fontSize(QWebSettings::DefaultFontSize)); }
void SettingsDialog::loadDefaults() { QWebSettings *defaultSettings = QWebSettings::globalSettings(); QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); standardFont = QFont(standardFontFamily, standardFontSize); standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize())); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); fixedFont = QFont(fixedFontFamily, fixedFontSize); fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize())); comboMainMenu->setCurrentIndex(0); downloadsLocation->setText( DefaultDownloadPath( false ) ); enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled)); enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled)); blockPopups->setChecked( ! (defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows)) ); autoLoadImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages)); enableDiskCache->setChecked(false); chkSavePasswords->setChecked(false); checkBoxDeleteDownloads->setChecked(false); newTabAction->setCurrentIndex(0); comboBoxAV->setCurrentIndex(0); mouseweelClick->setCurrentIndex(1); comboBoxStyle->addItems(QStyleFactory::keys()); int ind = comboBoxStyle->findText(DefaultAppStyle()); if (ind >= 0) comboBoxStyle->setCurrentIndex(ind); chkUserStyleSheet->setChecked(false); chkUserAgent->setChecked(false); comboAgents->setEditText(""); chkExtViewer->setChecked(false); tbGoBack->setChecked( true ); tbGoForward->setChecked( true ); tbAddBook->setChecked( true ); tbHome->setChecked( true ); tbRefresh->setChecked( true ); tbAppStyle->setChecked( true ); tbPrivMode->setChecked( true ); tbPrefs->setChecked( true ); tbImages->setChecked( false ); tbProxy->setChecked( false ); proxyExcept->setChecked(false); tbCompatibility->setChecked( true ); tbReset->setChecked( false ); #ifndef Q_WS_WIN proxyAuto->setVisible(false); #endif tbInspect->setChecked( false ); tbVirtKeyb->setChecked( false ); tbBookmarks->setChecked( false ); tbTextSize->setChecked( false ); expireHistory->setCurrentIndex(1); chkBlockAds->setChecked(false); listAds->clear(); chkBlockAdsEx->setChecked(false); listAdEx->clear(); }