ソースを参照

ctkConsoleCompleter - Add AutocompletePreferenceList

This list allows to specify options that could be
selected by default if multiple choices are proposed to the user.
Jean-Christophe Fillion-Robin 14 年 前
コミット
029d388dfd
共有2 個のファイルを変更した33 個の追加0 個の削除を含む
  1. 18 0
      Libs/Widgets/ctkConsole.cpp
  2. 15 0
      Libs/Widgets/ctkConsole.h

+ 18 - 0
Libs/Widgets/ctkConsole.cpp

@@ -67,6 +67,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "ctkPimpl.h"
 
 //-----------------------------------------------------------------------------
+// ctkConsoleCompleter methods
+
+//-----------------------------------------------------------------------------
+QStringList ctkConsoleCompleter::autocompletePreferenceList()
+{
+  return this->AutocompletePreferenceList;
+}
+
+//-----------------------------------------------------------------------------
+void ctkConsoleCompleter::setAutocompletePreferenceList(const QStringList& list)
+{
+  this->AutocompletePreferenceList = list;
+}
+
+//-----------------------------------------------------------------------------
 // ctkConsolePrivate methods
 
 //-----------------------------------------------------------------------------
@@ -642,6 +657,9 @@ void ctkConsole::setFormat(const QTextCharFormat& Format)
 }
 
 //-----------------------------------------------------------------------------
+CTK_GET_CPP(ctkConsole, ctkConsoleCompleter*, completer, Completer);
+
+//-----------------------------------------------------------------------------
 void ctkConsole::setCompleter(ctkConsoleCompleter* completer)
 {
   Q_D(ctkConsole);

+ 15 - 0
Libs/Widgets/ctkConsole.h

@@ -101,6 +101,9 @@ public:
   /// Sets formatting that will be used by printMessage()
   void setFormat(const QTextCharFormat& Format);
 
+  /// Return the completer of this console
+  ctkConsoleCompleter* completer() const;
+
   /// Set a completer for this console
   void setCompleter(ctkConsoleCompleter* completer);
 
@@ -197,6 +200,18 @@ public:
   /// is the current console text between the cursor and the start of
   /// the line.
   virtual void updateCompletionModel(const QString& str) = 0;
+
+  /// Returns the autocomplete preference list
+  QStringList autocompletePreferenceList();
+
+  /// Set autocomplete preference list
+  /// This list allows to specify options that could be
+  /// selected by default if multiple choices are proposed to the user.
+  void setAutocompletePreferenceList(const QStringList& list);
+
+protected:
+
+  QStringList AutocompletePreferenceList;
 };