BibleTime
src
frontend
keychooser
versekeychooser
btversekeymenu.cpp
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
#include "
btversekeymenu.h
"
14
15
#include <QMenu>
16
#include <QTimerEvent>
17
#include "../../../util/btconnect.h"
18
19
20
BtVerseKeyMenu::BtVerseKeyMenu
(
QWidget
* parent)
21
:
QMenu
(parent)
22
, m_timerId(0)
23
, m_firstClickLock(true)
24
{
25
BT_CONNECT
(
this
, &QMenu::aboutToShow,
26
[
this
] {
27
m_firstClickLock
=
true
;
28
if
(
m_timerId
) {
29
killTimer(
m_timerId
);
30
m_timerId
= 0;
31
}
32
m_timerId
= startTimer(300);
33
});
34
}
35
36
void
BtVerseKeyMenu::timerEvent
(QTimerEvent* e) {
37
if
(e->timerId() ==
m_timerId
) {
38
if
(
m_timerId
) {
39
killTimer(
m_timerId
);
40
m_timerId
= 0;
41
}
42
m_firstClickLock
=
false
;
43
}
44
else
{
45
QMenu::timerEvent(e);
46
}
47
}
48
49
void
BtVerseKeyMenu::mouseReleaseEvent
(QMouseEvent* e) {
50
if
(
m_firstClickLock
)
return
;
51
QMenu::mouseReleaseEvent(e);
52
}
BT_CONNECT
#define BT_CONNECT(...)
Definition:
btconnect.h:20
btversekeymenu.h
BtVerseKeyMenu::m_firstClickLock
bool m_firstClickLock
Definition:
btversekeymenu.h:42
BtVerseKeyMenu::timerEvent
void timerEvent(QTimerEvent *event) override
Definition:
btversekeymenu.cpp:36
BtVerseKeyMenu::m_timerId
int m_timerId
Definition:
btversekeymenu.h:41
BtVerseKeyMenu::BtVerseKeyMenu
BtVerseKeyMenu(QWidget *parent)
Definition:
btversekeymenu.cpp:20
BtVerseKeyMenu::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Definition:
btversekeymenu.cpp:49
QMenu
QWidget
Generated by
1.9.1