• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ aggregation::Aggregate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中aggregation::Aggregate的典型用法代码示例。如果您正苦于以下问题:C++ Aggregate类的具体用法?C++ Aggregate怎么用?C++ Aggregate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Aggregate类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: changeEditor

void FindMacroHandler::changeEditor(Core::IEditor *editor)
{
    if (!isRecording() || !editor || !editor->widget())
        return;

    Aggregation::Aggregate *aggregate = Aggregation::Aggregate::parentAggregate(editor->widget());
    if (aggregate) {
        Core::IFindSupport *currentFind = aggregate->component<Core::IFindSupport>();
        if (currentFind) {
            MacroTextFind *macroFind = qobject_cast<MacroTextFind *>(currentFind);
            if (macroFind)
                return;

            aggregate->remove(currentFind);
            macroFind = new MacroTextFind(currentFind);
            aggregate->add(macroFind);

            // Connect all signals
            connect(macroFind, &MacroTextFind::allReplaced,
                    this, &FindMacroHandler::replaceAll);
            connect(macroFind, &MacroTextFind::incrementalFound,
                    this, &FindMacroHandler::findIncremental);
            connect(macroFind, &MacroTextFind::incrementalSearchReseted,
                    this, &FindMacroHandler::resetIncrementalSearch);
            connect(macroFind, &MacroTextFind::replaced,
                    this, &FindMacroHandler::replace);
            connect(macroFind, &MacroTextFind::stepFound,
                    this, &FindMacroHandler::findStep);
            connect(macroFind, &MacroTextFind::stepReplaced,
                    this, &FindMacroHandler::replaceStep);
        }
    }
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:33,代码来源:findmacrohandler.cpp


示例2: createNewOutputWindow

void OutputPane::createNewOutputWindow(RunControl *rc)
{
    connect(rc, SIGNAL(started()),
            this, SLOT(runControlStarted()));
    connect(rc, SIGNAL(finished()),
            this, SLOT(runControlFinished()));

    // First look if we can reuse a tab
    bool found = false;
    for (int i = 0; i < m_tabWidget->count(); ++i) {
        RunControl *old = runControlForTab(i);
        if (old->sameRunConfiguration(rc) && !old->isRunning()) {
            // Reuse this tab
            delete old;
            m_outputWindows.remove(old);
            OutputWindow *ow = static_cast<OutputWindow *>(m_tabWidget->widget(i));
            ow->grayOutOldContent();
            ow->verticalScrollBar()->setValue(ow->verticalScrollBar()->maximum());
            ow->setFormatter(rc->createOutputFormatter(ow));
            m_outputWindows.insert(rc, ow);
            found = true;
            break;
        }
    }
    if (!found) {
        OutputWindow *ow = new OutputWindow(m_tabWidget);
        ow->setFormatter(rc->createOutputFormatter(ow));
        Aggregation::Aggregate *agg = new Aggregation::Aggregate;
        agg->add(ow);
        agg->add(new Find::BaseTextFind(ow));
        m_outputWindows.insert(rc, ow);
        m_tabWidget->addTab(ow, rc->displayName());
    }
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:34,代码来源:outputwindow.cpp


示例3: 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;
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:57,代码来源:helpplugin.cpp


示例4:

Internal::OutputWindowPlainTextEdit *VcsOutputWindowPrivate::widget()
{
    if (!m_widget) {
        m_widget = new Internal::OutputWindowPlainTextEdit();
        Aggregation::Aggregate *agg = new Aggregation::Aggregate;
        agg->add(m_widget);
        agg->add(new Core::BaseTextFind(m_widget));
    }
    return m_widget;
}
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:10,代码来源:vcsoutputwindow.cpp


示例5: 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;
}
开发者ID:Distrotech,项目名称:qtcreator,代码行数:49,代码来源:helpplugin.cpp


示例6: QVBoxLayout

QWidget *TreeViewFind::createSearchableWrapper(QTreeView *treeView, FetchOption option)
{
    QWidget *widget = new QWidget;
    QVBoxLayout *vbox = new QVBoxLayout(widget);
    vbox->setMargin(0);
    vbox->setSpacing(0);
    vbox->addWidget(treeView);
    vbox->addWidget(new Core::FindToolBarPlaceHolder(widget));

    Aggregation::Aggregate *agg = new Aggregation::Aggregate;
    agg->add(treeView);
    agg->add(new TreeViewFind(treeView, Qt::DisplayRole, option));

    return widget;
}
开发者ID:hermixy,项目名称:qtplatz,代码行数:15,代码来源:treeviewfind.cpp


示例7: initialize

bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)

    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/imageviewer/ImageViewer.mimetypes.xml"), errorMessage))
        return false;

    d_ptr->factory = new ImageViewerFactory(this);
    Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
    aggregate->add(d_ptr->factory);

    addAutoReleasedObject(d_ptr->factory);
    return true;
}
开发者ID:renatofilho,项目名称:QtCreator,代码行数:15,代码来源:imageviewerplugin.cpp


示例8:

MessageOutputWindow::MessageOutputWindow()
{
    m_widget = new Core::OutputWindow(Core::Context(Core::Constants::C_GENERAL_OUTPUT_PANE));
    m_widget->setReadOnly(true);
    // Let selected text be colored as if the text edit was editable,
    // otherwise the highlight for searching is too light
    QPalette p = m_widget->palette();
    QColor activeHighlight = p.color(QPalette::Active, QPalette::Highlight);
    p.setColor(QPalette::Highlight, activeHighlight);
    QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText);
    p.setColor(QPalette::HighlightedText, activeHighlightedText);
    m_widget->setPalette(p);
    Aggregation::Aggregate *agg = new Aggregation::Aggregate;
    agg->add(m_widget);
    agg->add(new Core::BaseTextFind(m_widget));
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:16,代码来源:messageoutputwindow.cpp


示例9: OutputWindow

CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/)
{
    m_outputWindow = new OutputWindow();
    m_outputWindow->setWindowTitle(tr("Compile Output"));
    m_outputWindow->setWindowIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_WINDOW)));
    m_outputWindow->setReadOnly(true);
    m_outputWindow->setUndoRedoEnabled(false);

    Aggregation::Aggregate *agg = new Aggregation::Aggregate;
    agg->add(m_outputWindow);
    agg->add(new Find::BaseTextFind(m_outputWindow));

    qRegisterMetaType<QTextCharFormat>("QTextCharFormat");

    m_handler = new ShowOutputTaskHandler(this);
    ExtensionSystem::PluginManager::instance()->addObject(m_handler);
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:17,代码来源:compileoutputwindow.cpp


示例10: QVBoxLayout

QFrame *ItemViewFind::createSearchableWrapper(QAbstractItemView *treeView, ColorOption lightColored, FetchOption option)
{
    QFrame *widget = new QFrame;
    widget->setFrameStyle(QFrame::NoFrame);
    QVBoxLayout *vbox = new QVBoxLayout(widget);
    vbox->setMargin(0);
    vbox->setSpacing(0);
    vbox->addWidget(treeView);
    auto placeHolder = new FindToolBarPlaceHolder(widget);
    placeHolder->setLightColored(lightColored);
    vbox->addWidget(placeHolder);

    Aggregation::Aggregate *agg = new Aggregation::Aggregate;
    agg->add(treeView);
    agg->add(new ItemViewFind(treeView, Qt::DisplayRole, option));

    return widget;
}
开发者ID:AltarBeastiful,项目名称:qt-creator,代码行数:18,代码来源:itemviewfind.cpp


示例11: setReadOnly

OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
    Core::OutputWindow(Core::Context(C_VCS_OUTPUT_PANE), parent),
    m_defaultFormat(currentCharFormat()),
    m_errorFormat(m_defaultFormat),
    m_warningFormat(m_defaultFormat),
    m_commandFormat(m_defaultFormat),
    m_messageFormat(m_defaultFormat)
{
    using Utils::Theme;
    setReadOnly(true);
    setUndoRedoEnabled(false);
    setFrameStyle(QFrame::NoFrame);
    m_errorFormat.setForeground(Utils::creatorTheme()->color(Theme::OutputPanes_ErrorMessageTextColor));
    m_warningFormat.setForeground(Utils::creatorTheme()->color(Theme::OutputPanes_WarningMessageTextColor));
    m_commandFormat.setFontWeight(QFont::Bold);
    m_messageFormat.setForeground(Utils::creatorTheme()->color(Theme::OutputPanes_MessageOutput));
    m_formatter = new Utils::OutputFormatter;
    m_formatter->setPlainTextEdit(this);
    Aggregation::Aggregate *agg = new Aggregation::Aggregate;
    agg->add(this);
    agg->add(new Core::BaseTextFind(this));
}
开发者ID:yueying,项目名称:qt-creator,代码行数:22,代码来源:vcsoutputwindow.cpp


示例12: context

CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/)
{
    Core::Context context(Constants::C_COMPILE_OUTPUT);
    m_outputWindow = new Core::OutputWindow(context);
    m_outputWindow->setWindowTitle(tr("Compile Output"));
    m_outputWindow->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW)));
    m_outputWindow->setReadOnly(true);
    m_outputWindow->setUndoRedoEnabled(false);
    m_outputWindow->setMaxLineCount(MAX_LINECOUNT);

    Aggregation::Aggregate *agg = new Aggregation::Aggregate;
    agg->add(m_outputWindow);
    agg->add(new Find::BaseTextFind(m_outputWindow));

    qRegisterMetaType<QTextCharFormat>("QTextCharFormat");

    m_handler = new ShowOutputTaskHandler(this);
    ExtensionSystem::PluginManager::instance()->addObject(m_handler);
    connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
            this, SLOT(updateWordWrapMode()));
    updateWordWrapMode();
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:22,代码来源:compileoutputwindow.cpp


示例13: parentAggregate

void tst_Aggregate::parentAggregate()
{
    Aggregation::Aggregate aggregation;
    Aggregation::Aggregate aggregation2;
    Interface1 *component1 = new Interface1;
    Interface11 *component11 = new Interface11;
    QObject *component2 = new QObject;
    aggregation.add(component1);
    aggregation.add(component11);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(&aggregation), &aggregation);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(component1), &aggregation);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), &aggregation);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(component2), (Aggregation::Aggregate *)0);
    // test reparenting a component to another aggregate (should warn but not work)
    aggregation2.add(component11);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), &aggregation);
    // test adding an aggregate to an aggregate (should warn but not work)
    aggregation.add(&aggregation2);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(&aggregation2), &aggregation2);
    // test removing an object from an aggregation.
    aggregation.remove(component11);
    QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), (Aggregation::Aggregate *)0);
}
开发者ID:mornelon,项目名称:QtCreator_compliments,代码行数:23,代码来源:tst_aggregate.cpp


示例14: initializeEditor

void DocumentEditorPlugin::initializeEditor(DocumentEdit *editor)
{
    DocumentEditorInterface *editorInterface = new DocumentEditorInterface(editor);
    //QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed()));
    editor->setEditorInterface(editorInterface);

    Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
    m_context << uidm->uniqueIdentifier(Constants::C_DOCUMENTEDITOR);
//    if (!m_undoAction) {
//        m_undoAction      = registerNewAction(QLatin1String(Core::Constants::UNDO),
//                                              this, SLOT(undoAction()),
//                                              tr("&Undo"));
//        m_redoAction      = registerNewAction(QLatin1String(Core::Constants::REDO),
//                                              this, SLOT(redoAction()),
//                                              tr("&Redo"));
//        m_copyAction      = registerNewAction(QLatin1String(Core::Constants::COPY),
//                                              this, SLOT(copyAction()));
//        m_selectAllAction = registerNewAction(QLatin1String(Core::Constants::SELECTALL),
//                                              this, SLOT(selectAllAction()));
//    }

    // Font settings
    //TextEditor::TextEditorSettings *settings = TextEditor::TextEditorSettings::instance();
    //editor->setFontSettings(settings->fontSettings());
    //connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
    //        editor, SLOT(setFontSettings(TextEditor::FontSettings)));

    //QObject::connect(editor, SIGNAL(undoAvailable(bool)), this, SLOT(updateActions()));
    //QObject::connect(editor, SIGNAL(redoAvailable(bool)), this, SLOT(updateActions()));
    //QObject::connect(editor, SIGNAL(copyAvailable(bool)), this, SLOT(updateActions()));

    Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
    //DocumentEditorFind *DocumentEditorFind = new DocumentEditorFind(editor);
    //aggregate->add(binEditorFind);
    aggregate->add(editor);
}
开发者ID:pitservise,项目名称:ananas-creator,代码行数:36,代码来源:documenteditorplugin.cpp


示例15: ConsoleItemModel

Console::Console()
{
    m_consoleItemModel = new ConsoleItemModel(this);

    m_consoleWidget = new QWidget;
    m_consoleWidget->setWindowTitle(displayName());
    m_consoleWidget->setEnabled(true);

    QVBoxLayout *vbox = new QVBoxLayout(m_consoleWidget);
    vbox->setMargin(0);
    vbox->setSpacing(0);

    m_consoleView = new ConsoleView(m_consoleItemModel, m_consoleWidget);
    auto proxyModel = new ConsoleProxyModel(this);
    proxyModel->setSourceModel(m_consoleItemModel);
    connect(m_consoleItemModel,
            &ConsoleItemModel::selectEditableRow,
            proxyModel,
            &ConsoleProxyModel::selectEditableRow);

    //Scroll to bottom when rows matching current filter settings are inserted
    //Not connecting rowsRemoved as the only way to remove rows is to clear the
    //model which will automatically reset the view.
    connect(m_consoleItemModel, &QAbstractItemModel::rowsInserted,
            proxyModel, &ConsoleProxyModel::onRowsInserted);
    m_consoleView->setModel(proxyModel);

    connect(proxyModel, &ConsoleProxyModel::setCurrentIndex,
            m_consoleView->selectionModel(), &QItemSelectionModel::setCurrentIndex);
    connect(proxyModel, &ConsoleProxyModel::scrollToBottom,
            m_consoleView, &ConsoleView::onScrollToBottom);

    auto itemDelegate = new ConsoleItemDelegate(m_consoleItemModel, this);
    connect(m_consoleView->selectionModel(), &QItemSelectionModel::currentChanged,
            itemDelegate, &ConsoleItemDelegate::currentChanged);
    m_consoleView->setItemDelegate(itemDelegate);

    Aggregation::Aggregate *aggregate = new Aggregation::Aggregate();
    aggregate->add(m_consoleView);
    aggregate->add(new Core::ItemViewFind(m_consoleView));

    vbox->addWidget(m_consoleView);
    vbox->addWidget(new Core::FindToolBarPlaceHolder(m_consoleWidget));

    m_showDebugButton = new QToolButton(m_consoleWidget);
    m_showDebugButton->setAutoRaise(true);

    m_showDebugButtonAction = new Utils::SavedAction(this);
    m_showDebugButtonAction->setDefaultValue(true);
    m_showDebugButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_LOG));
    m_showDebugButtonAction->setToolTip(tr("Show debug, log, and info messages."));
    m_showDebugButtonAction->setCheckable(true);
    m_showDebugButtonAction->setChecked(true);
    m_showDebugButtonAction->setIcon(Utils::Icons::INFO_TOOLBAR.icon());
    connect(m_showDebugButtonAction, &Utils::SavedAction::toggled,
            proxyModel, &ConsoleProxyModel::setShowLogs);
    m_showDebugButton->setDefaultAction(m_showDebugButtonAction);

    m_showWarningButton = new QToolButton(m_consoleWidget);
    m_showWarningButton->setAutoRaise(true);

    m_showWarningButtonAction = new Utils::SavedAction(this);
    m_showWarningButtonAction->setDefaultValue(true);
    m_showWarningButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_WARNING));
    m_showWarningButtonAction->setToolTip(tr("Show warning messages."));
    m_showWarningButtonAction->setCheckable(true);
    m_showWarningButtonAction->setChecked(true);
    m_showWarningButtonAction->setIcon(Utils::Icons::WARNING_TOOLBAR.icon());
    connect(m_showWarningButtonAction, &Utils::SavedAction::toggled,
            proxyModel, &ConsoleProxyModel::setShowWarnings);
    m_showWarningButton->setDefaultAction(m_showWarningButtonAction);

    m_showErrorButton = new QToolButton(m_consoleWidget);
    m_showErrorButton->setAutoRaise(true);

    m_showErrorButtonAction = new Utils::SavedAction(this);
    m_showErrorButtonAction->setDefaultValue(true);
    m_showErrorButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_ERROR));
    m_showErrorButtonAction->setToolTip(tr("Show error messages."));
    m_showErrorButtonAction->setCheckable(true);
    m_showErrorButtonAction->setChecked(true);
    m_showErrorButtonAction->setIcon(Utils::Icons::CRITICAL_TOOLBAR.icon());
    connect(m_showErrorButtonAction, &Utils::SavedAction::toggled,
            proxyModel, &ConsoleProxyModel::setShowErrors);
    m_showErrorButton->setDefaultAction(m_showErrorButtonAction);

    m_spacer = new QWidget(m_consoleWidget);
    m_spacer->setMinimumWidth(30);

    m_statusLabel = new QLabel(m_consoleWidget);

    readSettings();
    connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
            this, &Console::writeSettings);
}
开发者ID:qtproject,项目名称:qt-creator,代码行数:95,代码来源:console.cpp


示例16: 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;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:62,代码来源:helpplugin.cpp



注:本文中的aggregation::Aggregate类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ fs::path类代码示例发布时间:2022-05-31
下一篇:
C++ agg::trans_affine类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap