Sfoglia il codice sorgente

ctkPythonConsole - disable RemoveTrailingSpaces and AutomaticIndentation

This mimics the behavior of the real python interpretor
Jean-Christophe Fillion-Robin 14 anni fa
parent
commit
ccd93dad88

+ 3 - 0
Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp

@@ -262,6 +262,9 @@ ctkPythonConsole::ctkPythonConsole(ctkAbstractPythonManager* pythonManager, QWid
   Q_D(ctkPythonConsole);
   this->setObjectName("pythonConsole");
 
+  // Disable RemoveTrailingSpaces and AutomaticIndentation
+  this->setEditorHints(this->editorHints() ^ (RemoveTrailingSpaces | AutomaticIndentation));
+
   // The call to mainContext() ensures that python has been initialized.
   Q_ASSERT(d->PythonManager);
   d->PythonManager->mainContext();

+ 2 - 0
Libs/Widgets/ctkConsole.h

@@ -184,6 +184,8 @@ private:
   Q_DISABLE_COPY(ctkConsole);
 };
 
+Q_DECLARE_OPERATORS_FOR_FLAGS(ctkConsole::EditorHints);
+
 //-----------------------------------------------------------------------------
 class CTK_WIDGETS_EXPORT ctkConsoleCompleter : public QCompleter
 {