[Kst] branches/work/kst/portto4/kst/src/widgets
Mike Fenton
mike at staikos.net
Mon Oct 1 17:55:47 CEST 2007
SVN commit 719662 by fenton:
Adding popup auto completion to kst combobox.
M +15 -0 combobox.cpp
M +3 -0 combobox.h
--- branches/work/kst/portto4/kst/src/widgets/combobox.cpp #719661:719662
@@ -10,19 +10,33 @@
***************************************************************************/
#include "combobox.h"
+#include <QLineEdit>
+#include <QCompleter>
namespace Kst {
ComboBox::ComboBox(QWidget *parent)
: QComboBox(parent), _editable(true) {
+ setupLineEdit();
}
ComboBox::ComboBox(bool editable, QWidget *parent)
: QComboBox(parent), _editable(editable) {
+ setupLineEdit();
}
+void ComboBox::setupLineEdit(void) {
+ setInsertPolicy(QComboBox::NoInsert);
+ QLineEdit *lineEdit = new QLineEdit(this);
+ setLineEdit(lineEdit);
+
+ QCompleter *currentCompleter = completer();
+ currentCompleter->setCompletionMode(QCompleter::PopupCompletion);
+}
+
+
ComboBox::~ComboBox() {
}
@@ -31,6 +45,7 @@
_editable = editable;
}
+
}
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/widgets/combobox.h #719661:719662
@@ -32,6 +32,9 @@
void setEditable(bool editable);
private:
+ void setupLineEdit(void);
+
+ private:
bool _editable;
};
More information about the Kst
mailing list