Merge pull request 'fix QCodeEdit code complete popup size' (#69) from master into release
Some checks failed
SHS Gitea/libs/pipeline/head There was a failure building this commit
Some checks failed
SHS Gitea/libs/pipeline/head There was a failure building this commit
Reviewed-on: https://git.shs.tools/SHS/libs/pulls/69
This commit was merged in pull request #69.
This commit is contained in:
@@ -1243,7 +1243,7 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
|
||||
hideHelp();
|
||||
return;
|
||||
}
|
||||
acl << wordsCompletitionList(scope.second);
|
||||
if (word_complet) acl << wordsCompletitionList(scope.second);
|
||||
QFont bf(font());
|
||||
bf.setBold(true);
|
||||
foreach (const ACPair & ac, acl) {
|
||||
@@ -1274,8 +1274,9 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
|
||||
completer->setVisible(true);
|
||||
//qApp->processEvents();
|
||||
int sz = completer->verticalScrollBar()->width();
|
||||
for (int i = 0; i < completer->header()->count(); ++i)
|
||||
sz += qMax<int>(sz, ((QAbstractItemView*)completer)->sizeHintForColumn(i));
|
||||
sz += ((QAbstractItemView*)completer)->viewport()->width();
|
||||
// for (int i = 0; i < completer->header()->count(); ++i)
|
||||
// sz += ((QAbstractItemView*)completer)->sizeHintForColumn(i);
|
||||
completer->resize(sz, fontHeight() * 16);
|
||||
} else
|
||||
completer->hide();
|
||||
|
||||
@@ -38,6 +38,7 @@ class QAD_WIDGETS_EXPORT QCodeEdit: public QWidget
|
||||
Q_PROPERTY(QString text READ text WRITE setText)
|
||||
Q_PROPERTY(bool showSpaces READ showSpaces WRITE setShowSpaces)
|
||||
Q_PROPERTY(bool showLineNumbers READ showLineNumbers WRITE setShowLineNumbers)
|
||||
Q_PROPERTY(bool wordCompletitionEnabled READ wordCompletitionEnabled WRITE setWordCompletitionEnabled)
|
||||
Q_PROPERTY(QFont editorFont READ editorFont WRITE setEditorFont)
|
||||
|
||||
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);}
|
||||
|
||||
bool wordCompletitionEnabled() const {return word_complet;}
|
||||
|
||||
protected:
|
||||
typedef QPair<QString, QString> StringsPair;
|
||||
typedef QPair<int, QList<StringsPair> > ACPair;
|
||||
@@ -111,6 +114,7 @@ private:
|
||||
QStringList cursor_scope;
|
||||
int prev_lc, auto_comp_pl, timer, cur_search_ind, pos_press, pos_el_press;
|
||||
bool spaces_, _ignore_focus_out, _first, _destructor, _replacing;
|
||||
bool word_complet;
|
||||
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void showEvent(QShowEvent * );
|
||||
@@ -163,6 +167,8 @@ public slots:
|
||||
void searchNext(bool next = true);
|
||||
void searchPrevious();
|
||||
void hideSearch();
|
||||
void setWordCompletitionEnabled(bool on) {word_complet = on;}
|
||||
|
||||
|
||||
signals:
|
||||
void textChanged();
|
||||
|
||||
Reference in New Issue
Block a user