fix QCodeEdit code complete popup size
This commit is contained in:
@@ -1243,7 +1243,7 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
|
|||||||
hideHelp();
|
hideHelp();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
acl << wordsCompletitionList(scope.second);
|
if (word_complet) acl << wordsCompletitionList(scope.second);
|
||||||
QFont bf(font());
|
QFont bf(font());
|
||||||
bf.setBold(true);
|
bf.setBold(true);
|
||||||
foreach (const ACPair & ac, acl) {
|
foreach (const ACPair & ac, acl) {
|
||||||
@@ -1274,8 +1274,9 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
|
|||||||
completer->setVisible(true);
|
completer->setVisible(true);
|
||||||
//qApp->processEvents();
|
//qApp->processEvents();
|
||||||
int sz = completer->verticalScrollBar()->width();
|
int sz = completer->verticalScrollBar()->width();
|
||||||
for (int i = 0; i < completer->header()->count(); ++i)
|
sz += ((QAbstractItemView*)completer)->viewport()->width();
|
||||||
sz += qMax<int>(sz, ((QAbstractItemView*)completer)->sizeHintForColumn(i));
|
// for (int i = 0; i < completer->header()->count(); ++i)
|
||||||
|
// sz += ((QAbstractItemView*)completer)->sizeHintForColumn(i);
|
||||||
completer->resize(sz, fontHeight() * 16);
|
completer->resize(sz, fontHeight() * 16);
|
||||||
} else
|
} else
|
||||||
completer->hide();
|
completer->hide();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class QAD_WIDGETS_EXPORT QCodeEdit: public QWidget
|
|||||||
Q_PROPERTY(QString text READ text WRITE setText)
|
Q_PROPERTY(QString text READ text WRITE setText)
|
||||||
Q_PROPERTY(bool showSpaces READ showSpaces WRITE setShowSpaces)
|
Q_PROPERTY(bool showSpaces READ showSpaces WRITE setShowSpaces)
|
||||||
Q_PROPERTY(bool showLineNumbers READ showLineNumbers WRITE setShowLineNumbers)
|
Q_PROPERTY(bool showLineNumbers READ showLineNumbers WRITE setShowLineNumbers)
|
||||||
|
Q_PROPERTY(bool wordCompletitionEnabled READ wordCompletitionEnabled WRITE setWordCompletitionEnabled)
|
||||||
Q_PROPERTY(QFont editorFont READ editorFont WRITE setEditorFont)
|
Q_PROPERTY(QFont editorFont READ editorFont WRITE setEditorFont)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -72,6 +73,8 @@ public:
|
|||||||
|
|
||||||
void registerAutoCompletitionClass(int id, ACClassType ac_class, const QString & name, const QIcon & icon = QIcon()) {ac_classes[id] = ACClass(id, ac_class, name, icon);}
|
void registerAutoCompletitionClass(int id, ACClassType ac_class, const QString & name, const QIcon & icon = QIcon()) {ac_classes[id] = ACClass(id, ac_class, name, icon);}
|
||||||
|
|
||||||
|
bool wordCompletitionEnabled() const {return word_complet;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef QPair<QString, QString> StringsPair;
|
typedef QPair<QString, QString> StringsPair;
|
||||||
typedef QPair<int, QList<StringsPair> > ACPair;
|
typedef QPair<int, QList<StringsPair> > ACPair;
|
||||||
@@ -111,6 +114,7 @@ private:
|
|||||||
QStringList cursor_scope;
|
QStringList cursor_scope;
|
||||||
int prev_lc, auto_comp_pl, timer, cur_search_ind, pos_press, pos_el_press;
|
int prev_lc, auto_comp_pl, timer, cur_search_ind, pos_press, pos_el_press;
|
||||||
bool spaces_, _ignore_focus_out, _first, _destructor, _replacing;
|
bool spaces_, _ignore_focus_out, _first, _destructor, _replacing;
|
||||||
|
bool word_complet;
|
||||||
|
|
||||||
bool eventFilter(QObject * o, QEvent * e);
|
bool eventFilter(QObject * o, QEvent * e);
|
||||||
void showEvent(QShowEvent * );
|
void showEvent(QShowEvent * );
|
||||||
@@ -163,6 +167,8 @@ public slots:
|
|||||||
void searchNext(bool next = true);
|
void searchNext(bool next = true);
|
||||||
void searchPrevious();
|
void searchPrevious();
|
||||||
void hideSearch();
|
void hideSearch();
|
||||||
|
void setWordCompletitionEnabled(bool on) {word_complet = on;}
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void textChanged();
|
void textChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user