当前位置: 首页>>代码示例>>C++>>正文


C++ HelpViewer类代码示例

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


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

示例1: showEntry

		void Preferences::showEntry(QWidget* child)
		{
			if (!widget_to_item_.has(child)) 
			{
				widget_stack->setCurrentIndex(0);
				return;
			}

			// enable or disable help button
			HelpViewer* hv = HelpViewer::getInstance(0);
			if (hv != 0) buttonBox->button(QDialogButtonBox::Help)->setEnabled(hv->hasHelpFor(child));

			// set the listview entry 
			QTreeWidgetItem* item = widget_to_item_[child];
			entries_listview->setCurrentItem(item);
			entries_listview->setItemSelected(item, true);
		
			if (item->parent() != 0) entries_listview->setItemExpanded(item->parent(), true);

			// is the child a direct child of the stacked widget?
			if (widget_stack->indexOf(child) != -1)
			{
				// show the child 
				widget_stack->setCurrentWidget(child);
				widget_stack->currentWidget()->show();

				return;
			}

 			if (!item_to_entry_.has(item->parent()))
			{
				BALLVIEW_DEBUG
				return;
			}
开发者ID:HeyJJ,项目名称:ball,代码行数:34,代码来源:preferences.C

示例2:

CentralWidget::~CentralWidget()
{
    TRACE_OBJ
#ifndef QT_NO_PRINTER
    delete printer;
#endif

    QStringList zoomFactors;
    QStringList currentPages;
    bool searchAttached = m_searchWidget->isAttached();

    int i = searchAttached ? 1 : 0;
    for (; i < tabWidget->count(); ++i) {
        HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
        if (viewer && viewer->source().isValid()) {
            currentPages << viewer->source().toString();
            zoomFactors << QString::number(viewer->scale());
        }
    }

    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
    helpEngine.setLastTabPage(tabWidget->currentIndex());
    helpEngine.setLastShownPages(currentPages);
    helpEngine.setSearchWasAttached(searchAttached);
    helpEngine.setLastZoomFactors(zoomFactors);
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例3: beginInsertRows

void OpenPagesModel::addPage(const QUrl &url, qreal zoom)
{
    beginInsertRows(QModelIndex(), rowCount(), rowCount());
    HelpViewer *page = new HelpViewer(zoom);
    connect(page, SIGNAL(titleChanged()), this, SLOT(handleTitleChanged()));
    m_pages << page;
    endInsertRows();
    page->setSource(url);
}
开发者ID:Herysutrisno,项目名称:qt-creator,代码行数:9,代码来源:openpagesmodel.cpp

示例4: 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

示例5: Q_ASSERT

void OpenPagesModel::removePage(int index)
{
    Q_ASSERT(index >= 0 && index < rowCount());
    beginRemoveRows(QModelIndex(), index, index);
    HelpViewer *page = m_pages.at(index);
    m_pages.removeAt(index);
    endRemoveRows();
    page->deleteLater();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例6: 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

示例7: engine

CentralWidget::~CentralWidget()
{
    QDir dir;
    QString currentPages;
    QHelpEngineCore engine(collectionFile, 0);

    if (engine.setupData()) {
        for (int i = 0; i < tabWidget->count(); ++i) {
            HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
            if (viewer && viewer->source().isValid())
                currentPages.append(viewer->source().toString()).append(QLatin1Char('|'));
        }
        engine.setCustomValue(QLatin1String("LastTabPage"), lastTabPage);
        engine.setCustomValue(QLatin1String("LastShownPages"), currentPages);
    }
}
开发者ID:halsten,项目名称:beaverdbg,代码行数:16,代码来源:centralwidget.cpp

示例8: currentHelpViewer

void CentralWidget::setSource(const QUrl &url)
{
    HelpViewer* viewer = currentHelpViewer();
    HelpViewer* lastViewer = qobject_cast<HelpViewer*>(tabWidget->widget(lastTabPage));

    if (!viewer && !lastViewer) {
        viewer = new HelpViewer(helpEngine, this);
        viewer->installEventFilter(this);
        lastTabPage = tabWidget->addTab(viewer, QString());
        tabWidget->setCurrentIndex(lastTabPage);
        connectSignals();
        qApp->processEvents();
    } else
        viewer = lastViewer;

    viewer->setSource(url);
    currentPageChanged(lastTabPage);
    viewer->setFocus(Qt::OtherFocusReason);
    tabWidget->setCurrentIndex(lastTabPage);
    tabWidget->setTabText(lastTabPage, quoteTabTitle(viewer->documentTitle()));
}
开发者ID:halsten,项目名称:beaverdbg,代码行数:21,代码来源:centralwidget.cpp

示例9: setCurrentPage

void GeneralSettingsPage::setCurrentPage()
{
    HelpViewer *viewer = CentralWidget::instance()->currentHelpViewer();
    if (viewer)
        m_ui->homePageLineEdit->setText(viewer->source().toString());
}
开发者ID:Herysutrisno,项目名称:qt-creator,代码行数:6,代码来源:generalsettingspage.cpp

示例10: currentHelpViewer

void CentralWidget::resetZoom()
{
    HelpViewer* viewer = currentHelpViewer();
    if (viewer)
        viewer->resetScale();
}
开发者ID:gidlbn,项目名称:dlbn_02,代码行数:6,代码来源:centralwidget.cpp

示例11: 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


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