GSI Object Oriented Online Offline (Go4)
GO4-5.3.2
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
qt4
Go4GUI
QGo4CommandsHistory.cpp
Go to the documentation of this file.
1
// $Id: QGo4CommandsHistory.cpp 1812 2015-11-26 06:54:25Z adamczew $
2
//-----------------------------------------------------------------------
3
// The GSI Online Offline Object Oriented (Go4) Project
4
// Experiment Data Processing at EE department, GSI
5
//-----------------------------------------------------------------------
6
// Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7
// Planckstr. 1, 64291 Darmstadt, Germany
8
// Contact: http://go4.gsi.de
9
//-----------------------------------------------------------------------
10
// This software can be used under the license agreements as stated
11
// in Go4License.txt file which is part of the distribution.
12
//-----------------------------------------------------------------------
13
14
#include "
QGo4CommandsHistory.h
"
15
16
#include <QKeyEvent>
17
18
#define GO4_COMHIS_MAX 50
19
20
21
QGo4CommandsHistory::QGo4CommandsHistory
(QWidget* w,
const
char
* name) :
22
QComboBox(w)
23
{
24
setObjectName(name ? name :
"Go4CommandsHistory"
);
25
setMaxCount(
GO4_COMHIS_MAX
);
26
setInsertPolicy(InsertAtTop);
27
setDuplicatesEnabled(
false
);
28
setAutoCompletion(
true
);
29
setEditable(
true
);
30
}
31
32
QGo4CommandsHistory::~QGo4CommandsHistory
()
33
{
34
}
35
36
void
QGo4CommandsHistory::keyPressEvent
(QKeyEvent* e)
37
{
38
if
( (e->key()==Qt::Key_Return) || (e->key()==Qt::Key_Enter) ){
39
if
(count()>=
GO4_COMHIS_MAX
) setInsertPolicy(InsertAtCurrent);
// overwrite last command
40
emit
enterPressedSingal
();
41
}
42
43
QComboBox::keyPressEvent(e);
44
}
45
46
QStringList
QGo4CommandsHistory::getHistory
(
int
max)
47
{
48
QStringList lst;
49
if
(max>count()) max = count();
50
51
for
(
int
i=0; i<max; i++)
52
lst.append(itemText(i));
53
54
return
lst;
55
}
QGo4CommandsHistory::getHistory
QStringList getHistory(int max=50)
Definition:
QGo4CommandsHistory.cpp:46
QGo4CommandsHistory::QGo4CommandsHistory
QGo4CommandsHistory(QWidget *w, const char *name=0)
Definition:
QGo4CommandsHistory.cpp:21
QGo4CommandsHistory.h
QGo4CommandsHistory::enterPressedSingal
void enterPressedSingal()
QGo4CommandsHistory::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e)
Definition:
QGo4CommandsHistory.cpp:36
GO4_COMHIS_MAX
#define GO4_COMHIS_MAX
Definition:
QGo4CommandsHistory.cpp:18
QGo4CommandsHistory::~QGo4CommandsHistory
virtual ~QGo4CommandsHistory()
Definition:
QGo4CommandsHistory.cpp:32
Generated on Fri Oct 26 2018 08:34:54 for GSI Object Oriented Online Offline (Go4) by
1.8.8