example 'cl-repl': add resize handle above line edit; fix mobile QML auto reload

This commit is contained in:
pls.153 2022-06-17 12:54:18 +02:00
parent 4059f5593f
commit 8d026cf2f0
7 changed files with 361 additions and 329 deletions

View file

@ -97,7 +97,7 @@ QVariant QT::block2(const QVariant& vCursor) {
QTextCursor* cursor = VAL(vCursor, TextCursor*);
if (cursor != nullptr) {
TextBlock* tmp = new TextBlock(cursor->block());
tmp->deleteLater();
QTimer::singleShot(0, tmp, &QObject::deleteLater);
return VAR(TextBlock*, tmp);
}
return QVariant();
@ -173,7 +173,7 @@ QVariant QT::findBlockByLineNumber(const QVariant& vDocument, const QVariant& vN
QTextDocument* document = VAL(vDocument, QTextDocument*);
if (document != nullptr) {
TextBlock* tmp = new TextBlock(document->findBlockByLineNumber(vNumber.toInt()));
tmp->deleteLater();
QTimer::singleShot(0, tmp, &QObject::deleteLater);
return VAR(TextBlock*, tmp);
}
return QVariant();
@ -191,7 +191,7 @@ QVariant QT::next(const QVariant& vBlock) {
QTextBlock* block = VAL(vBlock, TextBlock*);
if (block != nullptr) {
TextBlock* tmp = new TextBlock(block->next());
tmp->deleteLater();
QTimer::singleShot(0, tmp, &QObject::deleteLater);
return VAR(TextBlock*, tmp);
}
return QVariant();
@ -217,7 +217,7 @@ QVariant QT::previous(const QVariant& vBlock) {
QTextBlock* block = VAL(vBlock, TextBlock*);
if (block != nullptr) {
TextBlock* tmp = new TextBlock(block->previous());
tmp->deleteLater();
QTimer::singleShot(0, tmp, &QObject::deleteLater);
return VAR(TextBlock*, tmp);
}
return QVariant();

View file

@ -14,4 +14,6 @@ to store their pointer values in a `QVariant`.
If we need to return a non `QObject` value to Lisp (not a pointer or primitive
value, but a class like `TextBlock` in this example, that is a `QTextBlock`
extended with a `QObject`), a new instance is created on the heap, calling
`deleteLater()` on it, which should be sufficient in most cases.
`QTimer::singleShot(0, tmp, &QObject::deleteLater)` on it, which should be
sufficient in any circumstance. The additional timer is need here because of
`SplitView`, which delays certain events.