本文整理汇总了C++中HelpViewer::setScale方法的典型用法代码示例。如果您正苦于以下问题:C++ HelpViewer::setScale方法的具体用法?C++ HelpViewer::setScale怎么用?C++ HelpViewer::setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelpViewer
的用法示例。
在下文中一共展示了HelpViewer::setScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QtWebKitHelpViewer
HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
{
// check for backends
typedef std::function<HelpViewer *()> ViewerFactory;
typedef QPair<QByteArray, ViewerFactory> ViewerFactoryItem; // id -> factory
QVector<ViewerFactoryItem> factories;
#ifndef QT_NO_WEBKIT
factories.append(qMakePair(QByteArray("qtwebkit"), []() { return new QtWebKitHelpViewer(); }));
#endif
#ifdef QTC_WEBENGINE_HELPVIEWER
factories.append(qMakePair(QByteArray("qtwebengine"), []() { return new WebEngineHelpViewer(); }));
#endif
factories.append(qMakePair(QByteArray("textbrowser"), []() { return new TextBrowserHelpViewer(); }));
#ifdef QTC_MAC_NATIVE_HELPVIEWER
// default setting
#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT
factories.prepend(qMakePair(QByteArray("native"), []() { return new MacWebKitHelpViewer(); }));
#else
factories.append(qMakePair(QByteArray("native"), []() { return new MacWebKitHelpViewer(); }));
#endif
#endif
HelpViewer *viewer = nullptr;
// check requested backend
const QByteArray backend = qgetenv("QTC_HELPVIEWER_BACKEND");
if (!backend.isEmpty()) {
const int pos = Utils::indexOf(factories, [backend](const ViewerFactoryItem &item) {
return backend == item.first;
});
if (pos == -1) {
qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData());
} else {
viewer = factories.at(pos).second();
}
}
if (!viewer)
viewer = factories.first().second();
QTC_ASSERT(viewer, return nullptr);
// initialize font
viewer->setViewerFont(LocalHelpManager::fallbackFont());
connect(LocalHelpManager::instance(), &LocalHelpManager::fallbackFontChanged,
viewer, &HelpViewer::setViewerFont);
// initialize zoom
viewer->setScale(zoom);
// add find support
Aggregation::Aggregate *agg = new Aggregation::Aggregate();
agg->add(viewer);
agg->add(new HelpViewerFindSupport(viewer));
return viewer;
}
示例2: MacWebKitHelpViewer
HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
{
// check for backends
typedef std::function<HelpViewer *()> ViewerFactory;
QHash<QString, ViewerFactory> factories; // id -> factory
#ifdef QTC_MAC_NATIVE_HELPVIEWER
factories.insert(QLatin1String("native"), []() { return new MacWebKitHelpViewer(); });
#endif
#ifndef QT_NO_WEBKIT
factories.insert(QLatin1String("qtwebkit"), []() { return new QtWebKitHelpViewer(); });
#endif
factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); });
ViewerFactory factory;
// check requested backend
const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND"));
if (!backend.isEmpty()) {
factory = factories.value(backend);
if (!factory)
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
}
// default setting
#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT
if (!factory)
factory = factories.value(QLatin1String("native"));
#endif
if (!factory)
factory = factories.value(QLatin1String("qtwebkit"));
if (!factory)
factory = factories.value(QLatin1String("textbrowser"));
QTC_ASSERT(factory, return 0);
HelpViewer *viewer = factory();
// initialize font
viewer->setViewerFont(LocalHelpManager::fallbackFont());
connect(LocalHelpManager::instance(), &LocalHelpManager::fallbackFontChanged,
viewer, &HelpViewer::setViewerFont);
// initialize zoom
viewer->setScale(zoom);
// add find support
Aggregation::Aggregate *agg = new Aggregation::Aggregate();
agg->add(viewer);
agg->add(new HelpViewerFindSupport(viewer));
return viewer;
}
示例3: MacWebKitHelpViewer
HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
{
// check for backends
typedef std::function<HelpViewer *()> ViewerFactory;
QHash<QString, ViewerFactory> factories; // id -> factory
#ifdef QTC_MAC_NATIVE_HELPVIEWER
factories.insert(QLatin1String("native"), []() { return new MacWebKitHelpViewer(); });
#endif
#ifndef QT_NO_WEBKIT
factories.insert(QLatin1String("qtwebkit"), []() { return new QtWebKitHelpViewer(); });
#endif
factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); });
ViewerFactory factory;
// TODO: Visual Studio < 2013 has a bug in std::function's operator bool, which in this case
// leads to succeeding boolean checks on factory which should not succeed.
// So we may not check against "if (!factory)"
bool factoryFound = false;
// check requested backend
const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND"));
if (!backend.isEmpty()) {
if (!factories.contains(backend)) {
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
} else {
factory = factories.value(backend);
factoryFound = true;
}
}
// default setting
#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT
if (!factoryFound && factories.contains(QLatin1String("native"))) {
factory = factories.value(QLatin1String("native"));
factoryFound = true;
}
#endif
if (!factoryFound && factories.contains(QLatin1String("qtwebkit"))) {
factory = factories.value(QLatin1String("qtwebkit"));
factoryFound = true;
}
if (!factoryFound && factories.contains(QLatin1String("textbrowser"))) {
factory = factories.value(QLatin1String("textbrowser"));
factoryFound = true;
}
QTC_ASSERT(factoryFound, return 0);
HelpViewer *viewer = factory();
// initialize font
QVariant fontSetting = LocalHelpManager::engineFontSettings();
if (fontSetting.isValid())
viewer->setViewerFont(fontSetting.value<QFont>());
// initialize zoom
viewer->setScale(zoom);
// add find support
Aggregation::Aggregate *agg = new Aggregation::Aggregate();
agg->add(viewer);
agg->add(new HelpViewerFindSupport(viewer));
return viewer;
}