Qt 4.8
Classes | Functions
qscriptdebuggerconsolewidget.cpp File Reference
#include "qscriptdebuggerconsolewidget_p.h"
#include "qscriptdebuggerconsolewidgetinterface_p_p.h"
#include "qscriptdebuggerconsolehistorianinterface_p.h"
#include "qscriptcompletionproviderinterface_p.h"
#include "qscriptcompletiontaskinterface_p.h"
#include <QtCore/qdebug.h>
#include <QtGui/qplaintextedit.h>
#include <QtGui/qlabel.h>
#include <QtGui/qlineedit.h>
#include <QtGui/qlistview.h>
#include <QtGui/qscrollbar.h>
#include <QtGui/qboxlayout.h>
#include <QtGui/qcompleter.h>
#include "qscriptdebuggerconsolewidget.moc"
#include "moc_qscriptdebuggerconsolewidget_p.cpp"

Go to the source code of this file.

Classes

class  QScriptDebuggerConsoleWidgetPrivate
 

Functions

static bool lengthLessThan (const QString &s1, const QString &s2)
 
static QString longestCommonPrefix (const QStringList &lst)
 

Function Documentation

◆ lengthLessThan()

static bool lengthLessThan ( const QString s1,
const QString s2 
)
static

Definition at line 245 of file qscriptdebuggerconsolewidget.cpp.

Referenced by QScriptDebuggerConsoleWidgetPrivate::_q_onCompletionTaskFinished().

246 {
247  return s1.length() < s2.length();
248 }
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696

◆ longestCommonPrefix()

static QString longestCommonPrefix ( const QStringList lst)
static

Definition at line 251 of file qscriptdebuggerconsolewidget.cpp.

Referenced by QScriptDebuggerConsoleWidgetPrivate::_q_onCompletionTaskFinished().

252 {
253  QString result = lst.last();
254  for (int i = lst.size() - 2; (i >= 0) && !result.isEmpty(); --i) {
255  const QString &s = lst.at(i);
256  int j = 0;
257  for ( ; (j < qMin(s.length(), result.length())) && (s.at(j) == result.at(j)); ++j)
258  ;
259  result = result.left(j);
260  }
261  return result;
262 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
int size() const
Returns the number of items in the list.
Definition: qlist.h:137