forked from Dax89/QHexView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qhexeditcomments.cpp
41 lines (33 loc) · 914 Bytes
/
qhexeditcomments.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "qhexeditcomments.h"
QHexEditComments::QHexEditComments(QObject *parent): QObject(parent)
{
}
void QHexEditComments::commentRange(qint64 from, qint64 to, const QString ¬e)
{
this->_notes.addRange(from, to, note);
}
void QHexEditComments::uncommentRange(qint64 from, qint64 to)
{
this->_notes.clearRange(from, to);
}
void QHexEditComments::clearComments()
{
QToolTip::hideText();
this->_notes.clear();
}
bool QHexEditComments::isCommented(qint64 offset)
{
return this->_notes.contains(offset);
}
void QHexEditComments::displayNote(const QPoint& pos, qint64 offset)
{
const QString* note = this->_notes.valueAt(offset);
if(note)
QToolTip::showText(pos, *note, qobject_cast<QWidget*>(this->parent()));
else
QToolTip::showText(pos, QString(), qobject_cast<QWidget*>(this->parent()));
}
void QHexEditComments::hideNote()
{
QToolTip::hideText();
}