blob: 5a3cd286e8f3067a72fd642e7848be6c1541a12c (
plain) (
blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#include "multieditorhex.h"
#include "qhexedit2/qhexedit.h"
#include "common/unused.h"
#include <QVBoxLayout>
MultiEditorHex::MultiEditorHex()
{
setLayout(new QVBoxLayout());
hexEdit = new QHexEdit();
layout()->addWidget(hexEdit);
//hexEdit->setTabChangesFocus(true);
connect(hexEdit, SIGNAL(dataChanged()), this, SLOT(modificationChanged()));
setFocusProxy(hexEdit);
}
MultiEditorHex::~MultiEditorHex()
{
}
void MultiEditorHex::setValue(const QVariant& value)
{
hexEdit->setData(value.toByteArray());
}
QVariant MultiEditorHex::getValue()
{
return hexEdit->data();
}
void MultiEditorHex::setReadOnly(bool value)
{
hexEdit->setReadOnly(value);
}
QString MultiEditorHex::getTabLabel()
{
return tr("Hex");
}
void MultiEditorHex::focusThisWidget()
{
hexEdit->setFocus();
}
QList<QWidget*> MultiEditorHex::getNoScrollWidgets()
{
return QList<QWidget*>();
}
void MultiEditorHex::modificationChanged()
{
emit valueModified();
}
MultiEditorWidget*MultiEditorHexPlugin::getInstance()
{
return new MultiEditorHex();
}
bool MultiEditorHexPlugin::validFor(const DataType& dataType)
{
UNUSED(dataType);
return true;
}
int MultiEditorHexPlugin::getPriority(const DataType& dataType)
{
switch (dataType.getType())
{
case DataType::BLOB:
return 1;
case DataType::BIGINT:
case DataType::DECIMAL:
case DataType::DOUBLE:
case DataType::INTEGER:
case DataType::INT:
case DataType::NUMERIC:
case DataType::REAL:
case DataType::BOOLEAN:
case DataType::NONE:
case DataType::STRING:
case DataType::TEXT:
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::DATE:
case DataType::DATETIME:
case DataType::TIME:
case DataType::unknown:
break;
}
return 100;
}
|