14 #include "../../bibletime.h"
17 #include <QGuiApplication>
19 #include <QMouseEvent>
20 #include <QQmlContext>
24 #include <QWheelEvent>
25 #include "../../../backend/drivers/cswordmoduleinfo.h"
26 #include "../../../backend/managers/cswordbackend.h"
27 #include "../../../util/btassert.h"
28 #include "../../BtMimeData.h"
41 engine()->addImportPath(QStringLiteral(
"qrc:/qt/qml"));
42 setSource(QUrl(QStringLiteral(
"qrc:/qt/qml/DisplayView.qml")));
48 int y = mapFromGlobal(QCursor::pos()).y();
49 if ((y >= 0) & (y-height() < 0))
64 if (
auto const *
const btmimedata =
65 qobject_cast<BTMimeData const *>(e->mimeData()))
67 auto const & item = btmimedata->bookmarks().first();
78 e->acceptProposedAction();
80 QQuickWidget::dragEnterEvent(e);
86 if (
auto const *
const btmimedata =
87 qobject_cast<BTMimeData const *>(e->mimeData()))
91 e->acceptProposedAction();
98 if (e->mimeData()->hasFormat(QStringLiteral(
"BibleTime/Bookmark"))) {
99 e->acceptProposedAction();
121 if (e->type() == QEvent::Leave)
123 return QQuickWidget::event(e);
132 if (
event->button() == Qt::LeftButton) {
133 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
134 auto const position =
event->pos();
136 auto const position =
event->position().toPoint();
138 callQml(
"leftMousePress", position.x(), position.y());
142 QQuickWidget::mousePressEvent(
event);
146 if ((
event->buttons() & Qt::LeftButton) == Qt::LeftButton) {
147 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
148 auto const position =
event->pos();
150 auto const position =
event->position().toPoint();
152 auto const y = position.y();
153 if (y < 0 || y > height()) {
160 callQml(
"leftMouseMove", position.x(), y);
164 return QQuickWidget::mouseMoveEvent(
event);
168 if (
event->button() == Qt::LeftButton) {
170 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
171 auto const position =
event->pos();
173 auto const position =
event->position().toPoint();
175 callQml(
"leftMouseRelease", position.x(), position.y());
179 return QQuickWidget::mouseReleaseEvent(
event);
184 QQuickWidget::wheelEvent(
event);
static BibleTime * instance() noexcept
QString const & key() const noexcept
CSwordKey * getMouseClickedKey() const
bool isBibleOrCommentary()
CSwordModuleInfo * findModuleByName(const QString &name) const
Searches for a module with the given name.
static CSwordBackend & instance() noexcept