예제 #1
0
/*!
    Returns the index widget.
*/
QHelpIndexWidget *QHelpEngine::indexWidget()
{
    if (!d->indexWidget) {
        d->indexWidget = new QHelpIndexWidget();
        d->indexWidget->setModel(d->indexModel);
        connect(d->indexModel, SIGNAL(indexCreationStarted()),
            d, SLOT(setIndexWidgetBusy()));
        connect(d->indexModel, SIGNAL(indexCreated()),
            d, SLOT(unsetIndexWidgetBusy()));
    }
    return d->indexWidget;
}
예제 #2
0
void HelpIndexView::CreateQtPartControl(QWidget* parent)
{
  if (m_IndexWidget == nullptr)
  {
    auto  layout = new QVBoxLayout(parent);
    //QLabel *l = new QLabel(tr("&Look for:"));
    //layout->addWidget(l);

    m_SearchLineEdit = new ctkSearchBox(parent);
    m_SearchLineEdit->setClearIcon(QIcon(":/org.blueberry.ui.qt.help/clear.png"));
    m_SearchLineEdit->setPlaceholderText("Filter...");
    m_SearchLineEdit->setContentsMargins(2,2,2,0);
    //l->setBuddy(m_SearchLineEdit);
    connect(m_SearchLineEdit, SIGNAL(textChanged(QString)), this,
            SLOT(filterIndices(QString)));
    m_SearchLineEdit->installEventFilter(this);
    layout->setMargin(0);
    layout->setSpacing(2);
    layout->addWidget(m_SearchLineEdit);

    QHelpEngineWrapper& helpEngine = HelpPluginActivator::getInstance()->getQHelpEngine();
    m_IndexWidget = new HelpIndexWidget();
    m_IndexWidget->setModel(helpEngine.indexModel());
    connect(helpEngine.indexModel(), SIGNAL(indexCreationStarted()),
            this, SLOT(setIndexWidgetBusy()));
    connect(helpEngine.indexModel(), SIGNAL(indexCreated()),
            this, SLOT(unsetIndexWidgetBusy()));
    m_IndexWidget->installEventFilter(this);

    connect(helpEngine.indexModel(), SIGNAL(indexCreationStarted()), this,
            SLOT(disableSearchLineEdit()));
    connect(helpEngine.indexModel(), SIGNAL(indexCreated()), this,
            SLOT(enableSearchLineEdit()));
    connect(m_IndexWidget, SIGNAL(linkActivated(QUrl,QString)), this,
            SLOT(linkActivated(QUrl)));
    connect(m_IndexWidget, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)),
            this, SLOT(linksActivated(QMap<QString,QUrl>,QString)));
    connect(m_SearchLineEdit, SIGNAL(returnPressed()), m_IndexWidget,
            SLOT(activateCurrentItem()));
    layout->addWidget(m_IndexWidget);

    m_IndexWidget->viewport()->installEventFilter(this);
  }
}