コード例 #1
0
void SonicPiScintilla::tabCompleteifList()
{
  if(isListActive())
    {
      SendScintilla(QsciCommand::Tab);
    }
}
コード例 #2
0
void SonicPiScintilla::completeListOrNewlineAndIndent(){
  if(isListActive()) {
    tabCompleteifList();
  }
  else {
    if(this->autoIndent->isChecked()) {
      newlineAndIndent();
    } else {
      newLine();
    }
  }
}
コード例 #3
0
ファイル: qgscodeeditor.cpp プロジェクト: aaime/QGIS
// This workaround a likely bug in QScintilla. The ESC key should not be consumned
// by the main entry, so that the default behavior (Dialog closing) can trigger,
// but only is the auto-completion suggestion list isn't displayed
void QgsCodeEditor::keyPressEvent( QKeyEvent *event )
{
  if ( event->key() == Qt::Key_Escape && !isListActive() )
  {
    // Shortcut QScintilla and redirect the event to the QWidget handler
    QWidget::keyPressEvent( event ); // clazy:exclude=skipped-base-method
  }
  else
  {
    QsciScintilla::keyPressEvent( event );
  }
}
コード例 #4
0
ファイル: ScriptEditor.cpp プロジェクト: spaceyatom/mantid
/**
 * Forward the QKeyEvent to the QsciScintilla base class. 
 * Under Gnome on Linux with Qscintilla versions < 2.4.2 there is a bug with the autocomplete
 * box that means the editor loses focus as soon as it the box appears. This functions
 * forwards the call and sets the correct flags on the resulting window so that this does not occur
 */
void ScriptEditor::forwardKeyPressToBase(QKeyEvent *event)
{
  // Hack to get around a bug in QScitilla
  //If you pressed ( after typing in a autocomplete command the calltip does not appear, you have to delete the ( and type it again
  //This does that for you!
  if (event->text()=="(")
  {
    QKeyEvent * backspEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
    QKeyEvent * bracketEvent = new QKeyEvent(*event);
    QsciScintilla::keyPressEvent(bracketEvent);
    QsciScintilla::keyPressEvent(backspEvent);

    delete backspEvent;
    delete bracketEvent;
  }


  QsciScintilla::keyPressEvent(event);
  
  // Only need to do this for Unix and for QScintilla version < 2.4.2. Moreover, only Gnome but I don't think we can detect that
#ifdef Q_OS_LINUX
#if QSCINTILLA_VERSION < 0x020402
  // If an autocomplete box has surfaced, correct the window flags. Unfortunately the only way to 
  // do this is to search through the child objects.
  if( isListActive() )
  {
    QObjectList children = this->children();
    QListIterator<QObject*> itr(children);
    // Search is performed in reverse order as we want the last one created
    itr.toBack();
    while( itr.hasPrevious() )
    {
      QObject *child = itr.previous();
      if( child->inherits("QListWidget") )
      {
        QWidget *w = qobject_cast<QWidget*>(child);
        w->setWindowFlags(Qt::ToolTip|Qt::WindowStaysOnTopHint);
        w->show();
        break;
      }
    }
  }  
#endif
#endif

}