Qt 4.8
Public Functions | Public Variables | List of all members
KeyRecorder Struct Reference

Public Functions

void clearKeys ()
 
KeyRecordfindKey (int code, bool remove)
 
 KeyRecorder ()
 
void storeKey (int code, int ascii, int state, const QString &text)
 

Public Variables

KeyRecord deleted_record
 
int nrecs
 
KeyRecord records [QT_MAX_KEY_RECORDINGS]
 

Detailed Description

Definition at line 107 of file qkeymapper_win.cpp.

Constructors and Destructors

◆ KeyRecorder()

KeyRecorder::KeyRecorder ( )
inline

Definition at line 109 of file qkeymapper_win.cpp.

109 : nrecs(0) {}

Functions

◆ clearKeys()

void KeyRecorder::clearKeys ( )
inline

Definition at line 157 of file qkeymapper_win.cpp.

Referenced by QKeyMapperPrivate::clearRecordedKeys().

158 {
159  nrecs = 0;
160 }

◆ findKey()

KeyRecord * KeyRecorder::findKey ( int  code,
bool  remove 
)
inline

Definition at line 121 of file qkeymapper_win.cpp.

Referenced by QKeyMapperPrivate::isADeadKey().

122 {
123  KeyRecord *result = 0;
124  for (int i = 0; i < nrecs; ++i) {
125  if (records[i].code == code) {
126  if (remove) {
127  deleted_record = records[i];
128  // Move rest down, and decrease count
129  while (i + 1 < nrecs) {
130  records[i] = records[i + 1];
131  ++i;
132  }
133  --nrecs;
134  result = &deleted_record;
135  } else {
136  result = &records[i];
137  }
138  break;
139  }
140  }
141  return result;
142 }
KeyRecord records[QT_MAX_KEY_RECORDINGS]
KeyRecord deleted_record

◆ storeKey()

void KeyRecorder::storeKey ( int  code,
int  ascii,
int  state,
const QString text 
)
inline

Definition at line 144 of file qkeymapper_win.cpp.

Referenced by QKeyMapperPrivate::isADeadKey().

145 {
147  "Internal KeyRecorder",
148  "Keyboard recorder buffer overflow, consider increasing QT_MAX_KEY_RECORDINGS");
149 
150  if (nrecs == QT_MAX_KEY_RECORDINGS) {
151  qWarning("Qt: Internal keyboard buffer overflow");
152  return;
153  }
154  records[nrecs++] = KeyRecord(code,ascii,state,text);
155 }
static const int QT_MAX_KEY_RECORDINGS
KeyRecord records[QT_MAX_KEY_RECORDINGS]
Q_CORE_EXPORT void qWarning(const char *,...)
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837

Properties

◆ deleted_record

KeyRecord KeyRecorder::deleted_record

Definition at line 116 of file qkeymapper_win.cpp.

◆ nrecs

int KeyRecorder::nrecs

Definition at line 115 of file qkeymapper_win.cpp.

◆ records

KeyRecord KeyRecorder::records[QT_MAX_KEY_RECORDINGS]

Definition at line 117 of file qkeymapper_win.cpp.


The documentation for this struct was generated from the following file: