コード例 #1
0
ファイル: resultscene.cpp プロジェクト: aarontc/kde-workspace
ResultScene::ResultScene(SharedResultData *resultData, Plasma::RunnerManager *manager, QWidget *focusBase, QObject *parent)
    : QGraphicsScene(parent),
      m_runnerManager(manager),
      m_viewableHeight(0),
      m_currentIndex(0),
      m_focusBase(focusBase),
      m_resultData(resultData)
{
    setItemIndexMethod(NoIndex);

    connect(m_runnerManager, SIGNAL(matchesChanged(QList<Plasma::QueryMatch>)),
            this, SLOT(setQueryMatches(QList<Plasma::QueryMatch>)));

    m_clearTimer.setSingleShot(true);
    m_clearTimer.setInterval(200);
    connect(&m_clearTimer, SIGNAL(timeout()), this, SLOT(clearMatches()));

    m_arrangeTimer.setSingleShot(true);
    m_arrangeTimer.setInterval(50);
    connect(&m_arrangeTimer, SIGNAL(timeout()), this, SLOT(arrangeItems()));

    m_selectionBar = new SelectionBar(0);
    connect(m_selectionBar, SIGNAL(appearanceChanged()), this, SLOT(updateItemMargins()));
    connect(m_selectionBar, SIGNAL(targetItemReached(QGraphicsItem*)), this, SLOT(highlightItem(QGraphicsItem*)));
    m_selectionBar->hide();
    updateItemMargins();

    addItem(m_selectionBar);
}
コード例 #2
0
ファイル: runnermodel.cpp プロジェクト: KDE/homerun
void RunnerModel::createManager()
{
    if (!m_manager) {
        // RunnerManager must have its own config group to store instance-specific config
        // (we don't want the manager from this RunnerModel to overwrite the config from another RunnerModel manager)
        m_manager = new Plasma::RunnerManager(m_configGroup, this);
        connect(m_manager, SIGNAL(matchesChanged(QList<Plasma::QueryMatch>)),
                this, SLOT(matchesChanged(QList<Plasma::QueryMatch>)));
        connect(m_manager, SIGNAL(queryFinished()),
                this, SLOT(queryHasFinished()));

        if (!m_pendingRunnersList.isEmpty()) {
            loadRunners();
        }
        //connect(m_manager, SIGNAL(queryFinished()), this, SLOT(queryFinished()));
    }
}
コード例 #3
0
KRunnerModel::KRunnerModel(QObject *parent)
        : QStandardItemModel(parent)
        , d(new Private())
{
    connect(runnerManager(),
            SIGNAL(matchesChanged(QList<Plasma::QueryMatch>)),
            this,
            SLOT(matchesChanged(QList<Plasma::QueryMatch>)));

    QHash<int, QByteArray> newRoleNames = roleNames();
    newRoleNames[CommonModel::Description] = "description";
    newRoleNames[CommonModel::Url] = "url";
    newRoleNames[CommonModel::Weight] = "weight";
    newRoleNames[CommonModel::ActionTypeRole] = "action";

    setRoleNames(newRoleNames);

    setSortRole(CommonModel::Weight);
}
コード例 #4
0
void ResourceFilter::updateResources(Resource::List availableResources)
{
    QRegExp regex(m_pattern, Qt::CaseInsensitive, QRegExp::Wildcard);

    m_matches.clear();
    auto all = availableResources;

    std::copy_if(all.begin(), all.end(),
                 std::back_inserter(m_matches),
                 [&](Resource *a){
        return regex.exactMatch(a->uri());
    });

    emit matchesChanged(matches());
}
コード例 #5
0
ファイル: qdescriptormatcher.cpp プロジェクト: livecv/livecv
void QDescriptorMatcher::callMatch(){
    if ( m_matcher && isComponentComplete() ){
        match(m_queryDescriptors, m_matches);
        emit matchesChanged();
    }
}