Example #1
0
void QgsFieldValuesLineEdit::triggerCompleterUpdate()
{
  mShowPopupTimer.stop();
  QString currentText = text();

  if ( currentText.isEmpty() )
  {
    if ( mGatherer )
      mGatherer->stop();
    return;
  }

  updateCompletionList( currentText );
}
Example #2
0
void QgsFieldValuesLineEdit::gathererThreadFinished()
{
  bool wasCancelled = mGatherer->wasCancelled();

  delete mGatherer;
  mGatherer = nullptr;

  if ( wasCancelled )
  {
    QString text = mRequestedCompletionText;
    mRequestedCompletionText.clear();
    updateCompletionList( text );
    return;
  }
}
void IncludeHelperCompletionModel::completionInvoked(
    KTextEditor::View* view
  , const KTextEditor::Range& range
  , InvocationType
  )
{
    auto* doc = view->document();
    kDebug(DEBUG_AREA) << range << ", " << doc->text(range);
    const auto& t = doc->line(range.start().line()).left(range.start().column());
    kDebug(DEBUG_AREA) << "text to parse: " << t;
    auto r = parseIncludeDirective(t, false);
    if (r.m_range.isValid())
    {
        m_should_complete = range.start().column() >= r.m_range.start().column()
            && range.start().column() <= r.m_range.end().column();
        if (m_should_complete)
        {
            r.m_range.setBothLines(range.start().line());
            kDebug(DEBUG_AREA) << "parsed range: " << r.m_range;
            m_closer = r.close_char();
            updateCompletionList(doc->text(r.m_range), r.m_type == IncludeStyle::local);
        }
    }
}