本文整理汇总了C++中QWebSettings::fontSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSettings::fontSize方法的具体用法?C++ QWebSettings::fontSize怎么用?C++ QWebSettings::fontSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebSettings
的用法示例。
在下文中一共展示了QWebSettings::fontSize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSettings
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();
}
示例2: loadDefaults
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);
}
示例3: eventFilter
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;
}
示例4:
GeneralSettingsPage::GeneralSettingsPage()
{
m_font = qApp->font();
#if !defined(QT_NO_WEBKIT)
QWebSettings* webSettings = QWebSettings::globalSettings();
m_font.setPointSize(webSettings->fontSize(QWebSettings::DefaultFontSize));
#endif
}
示例5: viewerFont
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));
}
示例6: loadDefaults
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));
}
示例7: viewerFont
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));
}
示例8: loadDefaults
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);
}
示例9: setId
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));
}
示例10: viewerFont
QFont QtWebKitHelpViewer::viewerFont() const
{
QWebSettings* webSettings = m_webView->settings();
return QFont(webSettings->fontFamily(QWebSettings::StandardFont),
webSettings->fontSize(QWebSettings::DefaultFontSize));
}
示例11: loadDefaults
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();
}