X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiWorkArea.cpp;h=02e03aaaeb780565d741ffd284345b3c09a852e9;hb=070270fdc719edcd0ae49a182acf58583038a765;hp=99e88bb328cf0584d71277504869fd232a8b382b;hpb=1b3ffa6627992edeb5b2f3be0cd47003e17a690d;p=features.git diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp index 99e88bb328..02e03aaaeb 100644 --- a/src/frontends/qt/GuiWorkArea.cpp +++ b/src/frontends/qt/GuiWorkArea.cpp @@ -40,9 +40,6 @@ #include "Undo.h" #include "version.h" -#include "graphics/GraphicsImage.h" -#include "graphics/GraphicsLoader.h" - #include "support/convert.h" #include "support/debug.h" #include "support/lassert.h" @@ -96,7 +93,7 @@ static mouse_button::state q_button_state(Qt::MouseButton button) case Qt::LeftButton: b = mouse_button::button1; break; - case Qt::MidButton: + case Qt::MiddleButton: b = mouse_button::button2; break; case Qt::RightButton: @@ -115,7 +112,7 @@ mouse_button::state q_motion_state(Qt::MouseButtons state) mouse_button::state b = mouse_button::none; if (state & Qt::LeftButton) b |= mouse_button::button1; - if (state & Qt::MidButton) + if (state & Qt::MiddleButton) b |= mouse_button::button2; if (state & Qt::RightButton) b |= mouse_button::button3; @@ -133,26 +130,15 @@ SyntheticMouseEvent::SyntheticMouseEvent() GuiWorkArea::Private::Private(GuiWorkArea * parent) -: p(parent), buffer_view_(nullptr), lyx_view_(nullptr), - caret_visible_(false), need_resize_(false), preedit_lines_(1), - last_pixel_ratio_(1.0), completer_(new GuiCompleter(p, p)), - dialog_mode_(false), shell_escape_(false), read_only_(false), - clean_(true), externally_modified_(false), needs_caret_geometry_update_(true) -{ -/* Qt on macOS and Wayland does not respect the - * Qt::WA_OpaquePaintEvent attribute and resets the widget backing - * store at each update. Therefore, we use our own backing store in - * these two cases. */ -#if QT_VERSION >= 0x050000 + : p(parent), completer_(new GuiCompleter(p, p)) +{ + /* Qt on macOS and Wayland does not respect the + * Qt::WA_OpaquePaintEvent attribute and resets the widget backing + * store at each update. Therefore, we use our own backing store + * in these two cases. + */ use_backingstore_ = guiApp->platformName() == "cocoa" || guiApp->platformName().contains("wayland"); -#else -# ifdef Q_OS_MAC - use_backingstore_ = true; -# else - use_backingstore_ = false; -# endif -#endif int const time = QApplication::cursorFlashTime() / 2; if (time > 0) { @@ -1345,7 +1331,11 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const switch (query) { // this is the CJK-specific composition window position and // the context menu position when the menu key is pressed. +#if (QT_VERSION < 0x050000) case Qt::ImMicroFocus: { +#else + case Qt::ImCursorRectangle: { +#endif CaretGeometry const & cg = bufferView().caretGeometry(); return QRect(cg.left - 10 * (d->preedit_lines_ != 1), cg.top + cg.height() * d->preedit_lines_, @@ -1559,7 +1549,7 @@ TabWorkArea::TabWorkArea(QWidget * parent) void TabWorkArea::mousePressEvent(QMouseEvent *me) { - if (me->button() == Qt::MidButton) + if (me->button() == Qt::MiddleButton) midpressed_tab_ = tabBar()->tabAt(me->pos()); else QTabWidget::mousePressEvent(me); @@ -1568,7 +1558,7 @@ void TabWorkArea::mousePressEvent(QMouseEvent *me) void TabWorkArea::mouseReleaseEvent(QMouseEvent *me) { - if (me->button() == Qt::MidButton) { + if (me->button() == Qt::MiddleButton) { int const midreleased_tab = tabBar()->tabAt(me->pos()); if (midpressed_tab_ == midreleased_tab && posIsTab(me->pos())) closeTab(midreleased_tab);