Version 1.13.0

This commit is contained in:
2020-09-16 01:28:37 +03:00
parent 1bcef63d3d
commit 22b9abfcb4
7 changed files with 81 additions and 13 deletions

View File

@@ -65,6 +65,7 @@ void QCodeEditCompleter::addItems(QFont f, const QCodeEdit::ACClass & cl, const
ni->setIcon(0, cl.icon);
ni->setText(0, s.type);
ni->setText(1, s.name);
ni->setData(0, Qt::UserRole, s.help_href);
addTopLevelItem(ni);
}
}
@@ -95,6 +96,26 @@ QString QCodeEditCompleter::currentValue() const {
}
void QCodeEditCompleter::keyPressEvent(QKeyEvent * e) {
switch (e->key()) {
case Qt::Key_Escape:
hide();
break;
case Qt::Key_Return:
emit commit();
break;
case Qt::Key_F1:
if (currentItem()) {
QString href = currentItem()->data(0, Qt::UserRole).toString();
emit gotoHRef(QCodeEdit::ACEntry().addHelpHRef(href));
}
break;
default: break;
}
QTreeWidget::keyPressEvent(e);
}
void QCodeEditCompleter::adjust() {
int sz = sizeHint().width();
resize(sz, fontHeight() * 16);