diff --git a/src/core/management_layer/plugins/screenplay_text/text/handlers/abstract_key_handler.cpp b/src/core/management_layer/plugins/screenplay_text/text/handlers/abstract_key_handler.cpp index f72530ddc..a52a6dba1 100644 --- a/src/core/management_layer/plugins/screenplay_text/text/handlers/abstract_key_handler.cpp +++ b/src/core/management_layer/plugins/screenplay_text/text/handlers/abstract_key_handler.cpp @@ -21,9 +21,13 @@ AbstractKeyHandler::~AbstractKeyHandler() = default; void AbstractKeyHandler::handle(QEvent* _event) { if (_event->type() == QEvent::KeyPress) { + qDebug("press"); handleKeyEvent(static_cast(_event)); } else if (_event->type() == QEvent::InputMethod) { + qDebug("input"); handleInput(static_cast(_event)); + } else if (_event->type() == QEvent::InputMethod) { + qDebug("quesry"); } } diff --git a/src/core/management_layer/plugins/screenplay_text/text/handlers/scene_heading_handler.cpp b/src/core/management_layer/plugins/screenplay_text/text/handlers/scene_heading_handler.cpp index 6c0d51fdf..9dcf4f3ba 100644 --- a/src/core/management_layer/plugins/screenplay_text/text/handlers/scene_heading_handler.cpp +++ b/src/core/management_layer/plugins/screenplay_text/text/handlers/scene_heading_handler.cpp @@ -300,6 +300,7 @@ void SceneHeadingHandler::handleInput(QInputMethodEvent* _event) void SceneHeadingHandler::complete(const QString& _currentBlockText, const QString& _cursorBackwardText) { + qDebug("comp"); // // Текущая секция // diff --git a/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.cpp b/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.cpp index b7c008ce7..4f8f83279 100644 --- a/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.cpp +++ b/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.cpp @@ -356,6 +356,16 @@ void ScreenplayTextEdit::keyPressEvent(QKeyEvent* _event) } } +void ScreenplayTextEdit::inputMethodEvent(QInputMethodEvent* _event) +{ + BaseTextEdit::inputMethodEvent(_event); + + if (!_event->commitString().isEmpty()) { + auto handler = KeyProcessingLayer::KeyPressHandlerFacade::instance(this); + handler->handle(_event); + } +} + bool ScreenplayTextEdit::keyPressEventReimpl(QKeyEvent* _event) { bool isEventHandled = true; diff --git a/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.h b/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.h index 23eface6e..2da5366d0 100644 --- a/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.h +++ b/src/core/management_layer/plugins/screenplay_text/text/screenplay_text_edit.h @@ -125,6 +125,7 @@ class ScreenplayTextEdit : public BaseTextEdit * @brief Нажатия многих клавиш обрабатываются вручную */ void keyPressEvent(QKeyEvent* _event) override; + void inputMethodEvent(QInputMethodEvent* _event) override; /** * @brief Обрабатываем специфичные ситуации для редактора сценария diff --git a/src/corelib/ui/widgets/text_edit/completer/completer.cpp b/src/corelib/ui/widgets/text_edit/completer/completer.cpp index 8f0058dd5..5d32c0040 100644 --- a/src/corelib/ui/widgets/text_edit/completer/completer.cpp +++ b/src/corelib/ui/widgets/text_edit/completer/completer.cpp @@ -56,6 +56,7 @@ Completer::Implementation::Implementation(QWidget* _parent) : popup(new TreeView(_parent)) , popupDelegate(new TreeDelegate(popup)) { + popup->setEditTriggers(QAbstractItemView::NoEditTriggers); popup->setHeaderHidden(true); popup->setRootIsDecorated(false); popup->setMouseTracking(true); @@ -150,23 +151,23 @@ void Completer::showCompleter(const QRect& _rect) // FIXME: разобраться с проблемами backing store в маке // FIXME: в винде тоже не работает как хотелось бы, какие-то моргания // -#ifdef Q_OS_LINUX - const int finalHeight = static_cast(std::min(maxVisibleItems(), completionCount()) - * Ui::DesignSystem::treeOneLineItem().height()); - if (d->popupHeightAnimation.state() == QVariantAnimation::Stopped) { - d->popup->resize(d->popup->width(), d->popupHeightAnimation.startValue().toInt()); - d->popupHeightAnimation.setEndValue(finalHeight); - d->popupHeightAnimation.start(); - } else { - d->popup->resize(d->popup->width(), d->popupHeightAnimation.currentValue().toInt()); - if (d->popupHeightAnimation.endValue().toInt() != finalHeight) { - d->popupHeightAnimation.stop(); - d->popupHeightAnimation.setStartValue(d->popupHeightAnimation.currentValue()); - d->popupHeightAnimation.setEndValue(finalHeight); - d->popupHeightAnimation.start(); - } - } -#endif + //#ifdef Q_OS_LINUX + // const int finalHeight = static_cast(std::min(maxVisibleItems(), completionCount()) + // * Ui::DesignSystem::treeOneLineItem().height()); + // if (d->popupHeightAnimation.state() == QVariantAnimation::Stopped) { + // d->popup->resize(d->popup->width(), d->popupHeightAnimation.startValue().toInt()); + // d->popupHeightAnimation.setEndValue(finalHeight); + // d->popupHeightAnimation.start(); + // } else { + // d->popup->resize(d->popup->width(), d->popupHeightAnimation.currentValue().toInt()); + // if (d->popupHeightAnimation.endValue().toInt() != finalHeight) { + // d->popupHeightAnimation.stop(); + // d->popupHeightAnimation.setStartValue(d->popupHeightAnimation.currentValue()); + // d->popupHeightAnimation.setEndValue(finalHeight); + // d->popupHeightAnimation.start(); + // } + // } + //#endif } void Completer::closeCompleter() diff --git a/src/corelib/ui/widgets/text_edit/page/page_text_edit.cpp b/src/corelib/ui/widgets/text_edit/page/page_text_edit.cpp index 9d2637ebe..6eb59d713 100644 --- a/src/corelib/ui/widgets/text_edit/page/page_text_edit.cpp +++ b/src/corelib/ui/widgets/text_edit/page/page_text_edit.cpp @@ -2417,19 +2417,13 @@ void PageTextEdit::dropEvent(QDropEvent* e) */ void PageTextEdit::inputMethodEvent(QInputMethodEvent* e) { - -#ifdef QT_KEYPAD_NAVIGATION Q_D(PageTextEdit); +#ifdef QT_KEYPAD_NAVIGATION if (d->control->textInteractionFlags() & Qt::TextEditable && QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) setEditFocus(true); #endif - // - // На десктопе совершенно бесполезное действие, которое приводит только к лишнему срабатыванию - // события обработки текста документа - // - // d->sendControlEvent(e); - Q_UNUSED(e) + d->sendControlEvent(e); ensureCursorVisible(); }