-
Notifications
You must be signed in to change notification settings - Fork 0
/
TDBTrigrammeDialog.cpp
50 lines (40 loc) · 1.15 KB
/
TDBTrigrammeDialog.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
42
43
44
45
46
47
48
49
50
#include "TDBTrigrammeDialog.h"
TDBTrigrammeDialog::TDBTrigrammeDialog(QWidget* parent, QString initial) :
QDialog(parent)
{
setWindowTitle("Trigramme");
valid = new TDBTrigrammeValidator(this);
label = new QLabel("Trigramme", this);
trigramme_edit = new QLineEdit(this);
trigramme_edit->setText( initial.toUpper() );
trigramme_edit->setValidator(valid);
connect(trigramme_edit, SIGNAL(textChanged(QString)),
this, SLOT(trigrammeChanged(QString)));
layout = new QVBoxLayout(this);
layout->addWidget(label);
layout->addWidget(trigramme_edit);
setLayout(layout);
#if win32
// fait bugger sous 'nux, pas moyen d'avoir le curseur sans sélectionner
trigramme_edit->setFocus(Qt::PopupFocusReason);
#endif
trigramme_edit->setCursorPosition( initial.length() );
}
TDBTrigrammeDialog::~TDBTrigrammeDialog()
{
delete label;
delete trigramme_edit;
delete layout;
}
void TDBTrigrammeDialog::trigrammeChanged(QString trigramme)
{
if (trigramme.length() == 3)
{
accept();
return;
}
}
QString TDBTrigrammeDialog::trigramme()
{
return trigramme_edit->text();
}