BibleTime
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-2025 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
26class CSwordKey;
27class BtQmlInterface;
28
30 Q_OBJECT
31
32public:
33 BtQuickWidget(QWidget * const parent = nullptr);
34
35 void scroll(int pixels);
37 void pageDown();
38 void pageUp();
39
41
42 BtQmlInterface * qmlInterface() const noexcept { return m_qmlInterface; }
43
44protected:
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
56private: // 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
65private:
66
68
70
71Q_SIGNALS:
72 void referenceDropped(const QString& reference);
73};
void dropEvent(QDropEvent *e) override
void callQml(char const *const method, Args &&... args)
void referenceDropped(const QString &reference)
void dragEnterEvent(QDragEnterEvent *e) override
virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
BtQmlInterface * qmlInterface() const noexcept
void scroll(int pixels)
virtual void mouseReleaseEvent(QMouseEvent *event) override
virtual bool event(QEvent *e) override
virtual void wheelEvent(QWheelEvent *event) override
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
CSwordKey * getMouseClickedKey()
void dragMoveEvent(QDragMoveEvent *event) override
BtQmlInterface *const m_qmlInterface
QTimer m_scrollTimer
void updateReferenceText()