Line data Source code
1 : /// Including QT Headers
2 : #include <QKeyEvent>
3 : /// Including DBE
4 : #include "dbe/SearchComboBox.hpp"
5 :
6 0 : dbe::SearchComboBox::SearchComboBox ( QWidget * parent )
7 : : QComboBox ( parent ),
8 0 : UserText ( QString ( "" ) )
9 : {
10 0 : connect ( this, SIGNAL ( currentIndexChanged ( const QString & ) ), this,
11 : SLOT ( ChangeToolTip ( const QString & ) ) );
12 0 : }
13 :
14 0 : void dbe::SearchComboBox::focusInEvent ( QFocusEvent * Event )
15 : {
16 0 : UserText = currentText();
17 0 : QComboBox::focusInEvent ( Event );
18 0 : }
19 :
20 0 : void dbe::SearchComboBox::keyPressEvent ( QKeyEvent * Event )
21 : {
22 0 : switch ( Event->key() )
23 : {
24 0 : case Qt::Key_Return:
25 0 : emit ReturnPressed();
26 0 : return;
27 :
28 0 : default:
29 0 : break;
30 : }
31 :
32 0 : QComboBox::keyPressEvent ( Event );
33 :
34 0 : if ( currentText().compare ( UserText ) != 0 )
35 : {
36 0 : UserText = currentText();
37 0 : emit TextModified ( currentText() );
38 : }
39 : }
40 :
41 0 : void dbe::SearchComboBox::ChangeToolTip ( const QString & Text )
42 : {
43 0 : setToolTip ( QString ( "Search mode: %1" ).arg ( Text ) );
44 0 : }
|