BibleTime
src
frontend
display
modelview
btquickwidget.h
Go to the documentation of this file.
1
/*********
2
*
3
* In the name of the Father, and of the Son, and of the Holy Spirit.
4
*
5
* This file is part of BibleTime's source code, https://bibletime.info/
6
*
7
* Copyright 1999-2021 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
9
* version 2.0.
10
*
11
**********/
12
13
#pragma once
14
15
/**
16
The BtQuickWidget is a subclass of QQuickWidget. The subclass was
17
needed to be able to catch the drop event when a bookmark is dropped
18
on a read window.
19
*/
20
21
#include <QTimer>
22
#include <QWidget>
23
#include <QQuickWidget>
24
25
26
class
CSwordKey
;
27
class
BtQmlInterface
;
28
29
class
BtQuickWidget
:
public
QQuickWidget
{
30
Q_OBJECT
31
32
public
:
33
BtQuickWidget
(
QWidget
*
const
parent =
nullptr
);
34
35
void
scroll
(
int
pixels);
36
void
updateReferenceText
();
37
void
pageDown
();
38
void
pageUp
();
39
40
CSwordKey
*
getMouseClickedKey
();
41
42
BtQmlInterface
*
qmlInterface
() const noexcept {
return
m_qmlInterface
; }
43
44
protected
:
45
void
dragMoveEvent
(QDragMoveEvent *
event
)
override
;
46
void
dragEnterEvent
( QDragEnterEvent* e )
override
;
47
void
dropEvent
( QDropEvent* e )
override
;
48
49
virtual
bool
event
(QEvent* e)
override
;
50
virtual
void
mousePressEvent
(QMouseEvent *
event
)
override
;
51
virtual
void
mouseMoveEvent
(QMouseEvent *
event
)
override
;
52
virtual
void
mouseReleaseEvent
(QMouseEvent *
event
)
override
;
53
virtual
void
mouseDoubleClickEvent
(QMouseEvent *
event
)
override
;
54
virtual
void
wheelEvent
(QWheelEvent *
event
)
override
;
55
56
private
:
// methods:
57
58
template
<
typename
... Args>
59
void
callQml
(
char
const
*
const
method, Args && ... args) {
60
QMetaObject::invokeMethod(rootObject(),
61
method,
62
Q_ARG(QVariant, args)...);
63
}
64
65
private
:
66
67
BtQmlInterface
*
const
m_qmlInterface
;
68
69
QTimer
m_scrollTimer
;
70
71
Q_SIGNALS:
72
void
referenceDropped
(
const
QString& reference);
73
};
BtQmlInterface
Definition:
btqmlinterface.h:37
BtQuickWidget
Definition:
btquickwidget.h:29
BtQuickWidget::BtQuickWidget
BtQuickWidget(QWidget *const parent=nullptr)
Definition:
btquickwidget.cpp:32
BtQuickWidget::qmlInterface
BtQmlInterface * qmlInterface() const noexcept
Definition:
btquickwidget.h:42
BtQuickWidget::dropEvent
void dropEvent(QDropEvent *e) override
Definition:
btquickwidget.cpp:85
BtQuickWidget::callQml
void callQml(char const *const method, Args &&... args)
Definition:
btquickwidget.h:59
BtQuickWidget::pageUp
void pageUp()
Definition:
btquickwidget.cpp:110
BtQuickWidget::referenceDropped
void referenceDropped(const QString &reference)
BtQuickWidget::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *e) override
Definition:
btquickwidget.cpp:63
BtQuickWidget::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *event) override
Definition:
btquickwidget.cpp:145
BtQuickWidget::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event) override
Definition:
btquickwidget.cpp:131
BtQuickWidget::scroll
void scroll(int pixels)
Definition:
btquickwidget.cpp:116
BtQuickWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *event) override
Definition:
btquickwidget.cpp:167
BtQuickWidget::event
virtual bool event(QEvent *e) override
Definition:
btquickwidget.cpp:120
BtQuickWidget::wheelEvent
virtual void wheelEvent(QWheelEvent *event) override
Definition:
btquickwidget.cpp:182
BtQuickWidget::pageDown
void pageDown()
Definition:
btquickwidget.cpp:108
BtQuickWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
Definition:
btquickwidget.cpp:126
BtQuickWidget::getMouseClickedKey
CSwordKey * getMouseClickedKey()
Definition:
btquickwidget.cpp:112
BtQuickWidget::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *event) override
Definition:
btquickwidget.cpp:97
BtQuickWidget::m_qmlInterface
BtQmlInterface *const m_qmlInterface
Definition:
btquickwidget.h:67
BtQuickWidget::m_scrollTimer
QTimer m_scrollTimer
Definition:
btquickwidget.h:69
BtQuickWidget::updateReferenceText
void updateReferenceText()
Definition:
btquickwidget.cpp:106
CSwordKey
Definition:
cswordkey.h:22
QQuickWidget
QWidget
Generated by
1.9.1