QT_BEGIN_NAMESPACE

IndexWindow::IndexWindow(QHelpEngine *helpEngine, QWidget *parent)
    : QWidget(parent)
{
    m_helpEngine = helpEngine;
    
    QVBoxLayout *layout = new QVBoxLayout(this);
    QLabel *l = new QLabel(tr("&Look for:"));
    layout->addWidget(l);

    m_searchLineEdit = new QLineEdit();
    l->setBuddy(m_searchLineEdit);
    connect(m_searchLineEdit, SIGNAL(textChanged(const QString&)),
        this, SLOT(filterIndices(const QString&)));
    m_searchLineEdit->installEventFilter(this);
    layout->setMargin(4);
    layout->addWidget(m_searchLineEdit);

    m_indexWidget = m_helpEngine->indexWidget();
    m_indexWidget->installEventFilter(this);
    connect(m_helpEngine->indexModel(), SIGNAL(indexCreationStarted()),
        this, SLOT(disableSearchLineEdit()));
    connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()),
        this, SLOT(enableSearchLineEdit()));
    connect(m_indexWidget, SIGNAL(linkActivated(const QUrl&, const QString&)),
        this, SIGNAL(linkActivated(const QUrl&)));
    connect(m_indexWidget, SIGNAL(linksActivated(const QMap<QString, QUrl>&, const QString&)),
        this, SIGNAL(linksActivated(const QMap<QString, QUrl>&, const QString&)));
    connect(m_searchLineEdit, SIGNAL(returnPressed()),
        m_indexWidget, SLOT(activateCurrentItem()));
    layout->addWidget(m_indexWidget);
}
Beispiel #2
0
QT_BEGIN_NAMESPACE

IndexWindow::IndexWindow(QWidget *parent)
    : QWidget(parent)
    , m_searchLineEdit(new QLineEdit)
    , m_indexWidget(HelpEngineWrapper::instance().indexWidget())
{
    TRACE_OBJ
    QVBoxLayout *layout = new QVBoxLayout(this);
    QLabel *l = new QLabel(tr("&Look for:"));
    layout->addWidget(l);

    l->setBuddy(m_searchLineEdit);
    connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this,
        SLOT(filterIndices(QString)));
    m_searchLineEdit->installEventFilter(this);
    layout->setMargin(4);
    layout->addWidget(m_searchLineEdit);

    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
    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,
        SIGNAL(linkActivated(QUrl)));
    connect(m_indexWidget, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)),
        this, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)));
    connect(m_searchLineEdit, SIGNAL(returnPressed()), m_indexWidget,
        SLOT(activateCurrentItem()));
    layout->addWidget(m_indexWidget);

    m_indexWidget->viewport()->installEventFilter(this);
}
Beispiel #3
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);
  }
}
Beispiel #4
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;
}