Qt 4.8
qlinuxinput.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 
43 #include "qlinuxinput.h"
44 
45 
46 #include <QSocketNotifier>
47 #include <QStringList>
48 #include <QPoint>
49 #include <QWindowSystemInterface>
50 
51 #include <qkbd_qws.h>
52 
53 
54 #include <qplatformdefs.h>
55 #include <private/qcore_unix_p.h> // overrides QT_OPEN
56 
57 #include <errno.h>
58 #include <termios.h>
59 
60 #include <linux/kd.h>
61 #include <linux/input.h>
62 
63 #include <qdebug.h>
64 
66 
67 
68 //#define QT_QPA_EXPERIMENTAL_TOUCHEVENT
69 
70 #ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT
71 class QLinuxInputMouseHandlerData
72 {
73 public:
74  QLinuxInputMouseHandlerData() :seenMT(false), state(QEvent::TouchBegin), currentIdx(0) {}
75 
76  void ensureCurrentPoint() {
77  if (currentIdx >= touchPoints.size()) {
78  Q_ASSERT(currentIdx == touchPoints.size());
80  tp.id = currentIdx;
81  tp.isPrimary = (currentIdx == 0);
82  tp.pressure = 1;
83  tp.area = QRectF(0,0,1,1);
84  tp.state = Qt::TouchPointReleased; // init in neutral state
85  touchPoints.append(tp);
86  }
87  }
88  void setCurrentPoint(int i) {
89  currentIdx = i;
90  if (currentIdx < touchPoints.size()) {
91  currentX = int(touchPoints[currentIdx].area.left());
92  currentY = int(touchPoints[currentIdx].area.top());
93  } else {
94  currentY = currentX = -999;
95  }
96  }
97  void advanceCurrentPoint() {
98  setCurrentPoint(currentIdx + 1);
99  }
100  int currentPoint() { return currentIdx; }
101  void setCurrentX(int value) {
102  ensureCurrentPoint();
103  touchPoints[currentIdx].area.moveLeft(value);
104  }
105  bool currentMoved() {
106  return currentX != touchPoints[currentIdx].area.left() || currentY != touchPoints[currentIdx].area.top();
107  }
108  void updateCurrentPos() {
109  ensureCurrentPoint();
110  touchPoints[currentIdx].area.moveTopLeft(QPointF(currentX, currentY));
111  }
112  void setCurrentState(Qt::TouchPointState state) {
113  ensureCurrentPoint();
114  touchPoints[currentIdx].state = state;
115  }
116  Qt::TouchPointState currentState() const {
117  if (currentIdx < touchPoints.size())
118  return touchPoints[currentIdx].state;
119  return Qt::TouchPointReleased;
120  }
122  int currentX;
123  int currentY;
124  bool seenMT;
125  QEvent::Type state;
126 private:
127  int currentIdx;
128 };
129 #endif
130 
131 
133  const QString &specification)
134  : m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), m_xoffset(0), m_yoffset(0), m_buttons(0), d(0)
135 {
136  qDebug() << "QLinuxInputMouseHandler" << key << specification;
137 
138 
139  setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler"));
140 
141  QString dev = QLatin1String("/dev/input/event0");
142  m_compression = true;
143  m_smooth = false;
144  int jitterLimit = 0;
145 
146  QStringList args = specification.split(QLatin1Char(':'));
147  foreach (const QString &arg, args) {
148  if (arg == "nocompress")
149  m_compression = false;
150  else if (arg.startsWith("dejitter="))
151  jitterLimit = arg.mid(9).toInt();
152  else if (arg.startsWith("xoffset="))
153  m_xoffset = arg.mid(8).toInt();
154  else if (arg.startsWith("yoffset="))
155  m_yoffset = arg.mid(8).toInt();
156  else if (arg.startsWith(QLatin1String("/dev/")))
157  dev = arg;
158  }
159  m_jitterLimitSquared = jitterLimit*jitterLimit;
160 
161  m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
162  if (m_fd >= 0) {
164  connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
165  } else {
166  qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno));
167  return;
168  }
169 #ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT
170  d = new QLinuxInputMouseHandlerData;
171 #endif
172 }
173 
174 
176 {
177  if (m_fd >= 0)
178  QT_CLOSE(m_fd);
179 #ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT
180  delete d;
181 #endif
182 }
183 
184 void QLinuxInputMouseHandler::sendMouseEvent(int x, int y, Qt::MouseButtons buttons)
185 {
186  QPoint pos(x+m_xoffset, y+m_yoffset);
188  m_prevx = x;
189  m_prevy = y;
190 }
191 
193 {
194  struct ::input_event buffer[32];
195  int n = 0;
196  bool posChanged = false;
197  bool pendingMouseEvent = false;
198  int eventCompressCount = 0;
199  forever {
200  n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
201 
202  if (n == 0) {
203  qWarning("Got EOF from the input device.");
204  return;
205  } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
206  qWarning("Could not read from input device: %s", strerror(errno));
207  return;
208  } else if (n % sizeof(buffer[0]) == 0) {
209  break;
210  }
211  }
212 
213  n /= sizeof(buffer[0]);
214 
215  for (int i = 0; i < n; ++i) {
216  struct ::input_event *data = &buffer[i];
217  //qDebug() << ">>" << hex << data->type << data->code << dec << data->value;
218  bool unknown = false;
219  if (data->type == EV_ABS) {
220  if (data->code == ABS_X && m_x != data->value) {
221  m_x = data->value;
222  posChanged = true;
223  } else if (data->code == ABS_Y && m_y != data->value) {
224  m_y = data->value;
225  posChanged = true;
226  } else if (data->code == ABS_PRESSURE) {
227  //ignore for now...
228  } else if (data->code == ABS_TOOL_WIDTH) {
229  //ignore for now...
230  } else if (data->code == ABS_HAT0X) {
231  //ignore for now...
232  } else if (data->code == ABS_HAT0Y) {
233  //ignore for now...
234 #ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT
235  } else if (data->code == ABS_MT_POSITION_X) {
236  d->currentX = data->value;
237  d->seenMT = true;
238  } else if (data->code == ABS_MT_POSITION_Y) {
239  d->currentY = data->value;
240  d->seenMT = true;
241  } else if (data->code == ABS_MT_TOUCH_MAJOR) {
242  if (data->value == 0)
243  d->setCurrentState(Qt::TouchPointReleased);
244  //otherwise, ignore for now...
245  } else if (data->code == ABS_MT_TOUCH_MINOR) {
246  //ignore for now...
247 #endif
248  } else {
249  unknown = true;
250  }
251  } else if (data->type == EV_REL) {
252  if (data->code == REL_X) {
253  m_x += data->value;
254  posChanged = true;
255  } else if (data->code == REL_Y) {
256  m_y += data->value;
257  posChanged = true;
258  } else if (data->code == ABS_WHEEL) { // vertical scroll
259  // data->value: 1 == up, -1 == down
260  int delta = 120 * data->value;
262  QPoint(m_x, m_y),
263  delta, Qt::Vertical);
264  } else if (data->code == ABS_THROTTLE) { // horizontal scroll
265  // data->value: 1 == right, -1 == left
266  int delta = 120 * -data->value;
268  QPoint(m_x, m_y),
269  delta, Qt::Horizontal);
270  } else {
271  unknown = true;
272  }
273  } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
274  m_buttons = data->value ? Qt::LeftButton : Qt::NoButton;
275 
276  posChanged = true;
277  pendingMouseEvent = false;
278  } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_MIDDLE) {
279  Qt::MouseButton button = Qt::NoButton;
280  switch (data->code) {
281  case BTN_LEFT: button = Qt::LeftButton; break;
282  case BTN_MIDDLE: button = Qt::MidButton; break;
283  case BTN_RIGHT: button = Qt::RightButton; break;
284  }
285  if (data->value)
286  m_buttons |= button;
287  else
288  m_buttons &= ~button;
290  pendingMouseEvent = false;
291  } else if (data->type == EV_SYN && data->code == SYN_REPORT) {
292  if (posChanged) {
293  posChanged = false;
294  if (m_compression) {
295  pendingMouseEvent = true;
296  eventCompressCount++;
297  } else {
299  }
300  }
301 #ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT
302  if (d->state == QEvent::TouchBegin && !d->seenMT) {
303  //no multipoint-touch events to send
304  } else {
305  if (!d->seenMT)
306  d->state = QEvent::TouchEnd;
307 
308  for (int i = d->currentPoint(); i < d->touchPoints.size(); ++i) {
309  d->touchPoints[i].pressure = 0;
310  d->touchPoints[i].state = Qt::TouchPointReleased;
311  }
312  //qDebug() << "handleTouchEvent" << d->state << d->touchPoints.size() << d->touchPoints[0].state;
314  if (d->seenMT) {
315  d->state = QEvent::TouchUpdate;
316  } else {
317  d->state = QEvent::TouchBegin;
318  d->touchPoints.clear();
319  }
320  d->setCurrentPoint(0);
321  d->seenMT = false;
322  }
323  } else if (data->type == EV_SYN && data->code == SYN_MT_REPORT) {
324  //store data for this touch point
325 
326  if (!d->seenMT) {
327  d->setCurrentState(Qt::TouchPointReleased);
328  } else if (d->currentState() == Qt::TouchPointReleased) {
329  d->updateCurrentPos();
330  d->setCurrentState(Qt::TouchPointPressed);
331  } else if (d->currentMoved()) {
332  d->updateCurrentPos();
333  d->setCurrentState(Qt::TouchPointMoved);
334  } else {
335  d->setCurrentState(Qt::TouchPointStationary);
336  }
337  //qDebug() << "end of point" << d->currentPoint() << d->currentX << d->currentY << d->currentState();
338 
339  //advance to next tp:
340  d->advanceCurrentPoint();
341 #endif
342  } else if (data->type == EV_MSC && data->code == MSC_SCAN) {
343  // kernel encountered an unmapped key - just ignore it
344  continue;
345  } else {
346  unknown = true;
347  }
348 #ifdef QLINUXINPUT_EXTRA_DEBUG
349  if (unknown) {
350  qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value);
351  }
352 #endif
353  }
354  if (m_compression && pendingMouseEvent) {
355  int distanceSquared = (m_x - m_prevx)*(m_x - m_prevx) + (m_y - m_prevy)*(m_y - m_prevy);
356  if (distanceSquared > m_jitterLimitSquared)
358  }
359 }
360 
361 
362 
363 
364 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
365 //Keyboard handler
366 
367 
368 
369 
371 {
372 public:
375 
376  virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value);
377 
378 //private:
379 // QWSLinuxInputKbPrivate *d;
380 };
381 
382 
384  : QWSKeyboardHandler(device)
385 {
386 }
387 
389 {
390 }
391 
393 {
394  return false;
395 }
396 
397 
399  : m_handler(0), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
400 {
401  setObjectName(QLatin1String("LinuxInputSubsystem Keyboard Handler"));
402 
403  QString dev = QLatin1String("/dev/input/event1");
404  int repeat_delay = -1;
405  int repeat_rate = -1;
406 
407  bool ttymode = false;
408 
409  QStringList args = specification.split(QLatin1Char(':'));
410  foreach (const QString &arg, args) {
411  if (arg.startsWith(QLatin1String("repeat-delay=")))
412  repeat_delay = arg.mid(13).toInt();
413  else if (arg.startsWith(QLatin1String("repeat-rate=")))
414  repeat_rate = arg.mid(12).toInt();
415  else if (arg.startsWith(QLatin1String("ttymode")))
416  ttymode = true;
417  else if (arg.startsWith(QLatin1String("/dev/")))
418  dev = arg;
419  }
420 
421  m_handler = new QWSLinuxInputKeyboardHandler(dev); //This is a hack to avoid copying all the QWS code
422 
423  m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0);
424  if (m_fd >= 0) {
425  if (repeat_delay > 0 && repeat_rate > 0) {
426  int kbdrep[2] = { repeat_delay, repeat_rate };
427  ::ioctl(m_fd, EVIOCSREP, kbdrep);
428  }
429 
430  QSocketNotifier *notifier;
431  notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
432  connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode()));
433 
434  if (ttymode) {
435  // play nice in case we are started from a shell (e.g. for debugging)
436  m_tty_fd = isatty(0) ? 0 : -1;
437 
438  if (m_tty_fd >= 0) {
439  // save tty config for restore.
440  tcgetattr(m_tty_fd, &m_tty_attr);
441 
442  struct ::termios termdata;
443  tcgetattr(m_tty_fd, &termdata);
444 
445  // record the original mode so we can restore it again in the destructor.
446  ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
447 
448  // setting this translation mode is even needed in INPUT mode to prevent
449  // the shell from also interpreting codes, if the process has a tty
450  // attached: e.g. Ctrl+C wouldn't copy, but kill the application.
451  ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
452 
453  // set the tty layer to pass-through
454  termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
455  termdata.c_oflag = 0;
456  termdata.c_cflag = CREAD | CS8;
457  termdata.c_lflag = 0;
458  termdata.c_cc[VTIME]=0;
459  termdata.c_cc[VMIN]=1;
460  cfsetispeed(&termdata, 9600);
461  cfsetospeed(&termdata, 9600);
462  tcsetattr(m_tty_fd, TCSANOW, &termdata);
463  }
464  }
465  } else {
466  qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno));
467  return;
468  }
469 }
470 
472 {
473  if (m_tty_fd >= 0) {
474  ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
475  tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
476  }
477  if (m_fd >= 0)
478  QT_CLOSE(m_fd);
479  delete m_handler;
480 }
481 
482 void QLinuxInputKeyboardHandler::switchLed(int led, bool state)
483 {
484  struct ::input_event led_ie;
485  ::gettimeofday(&led_ie.time, 0);
486  led_ie.type = EV_LED;
487  led_ie.code = led;
488  led_ie.value = state;
489 
490  QT_WRITE(m_fd, &led_ie, sizeof(led_ie));
491 }
492 
493 
494 
496 {
497  struct ::input_event buffer[32];
498  int n = 0;
499 
500  forever {
501  n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
502 
503  if (n == 0) {
504  qWarning("Got EOF from the input device.");
505  return;
506  } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
507  qWarning("Could not read from input device: %s", strerror(errno));
508  return;
509  } else if (n % sizeof(buffer[0]) == 0) {
510  break;
511  }
512  }
513 
514  n /= sizeof(buffer[0]);
515 
516  for (int i = 0; i < n; ++i) {
517  if (buffer[i].type != EV_KEY)
518  continue;
519 
520  quint16 code = buffer[i].code;
521  qint32 value = buffer[i].value;
522 
523  if (m_handler->filterInputEvent(code, value))
524  continue;
525 
527  ka = m_handler->processKeycode(code, value != 0, value == 2);
528 
529  switch (ka) {
532  switchLed(LED_CAPSL, ka == QWSKeyboardHandler::CapsLockOn);
533  break;
534 
537  switchLed(LED_NUML, ka == QWSKeyboardHandler::NumLockOn);
538  break;
539 
542  switchLed(LED_SCROLLL, ka == QWSKeyboardHandler::ScrollLockOn);
543  break;
544 
545  default:
546  // ignore console switching and reboot
547  break;
548  }
549  }
550 }
551 
552 
553 
554 
555 
557 
double d
Definition: qnumeric_p.h:62
The QWSKeyboardHandler class is a base class for keyboard drivers in Qt for Embedded Linux...
Definition: qkbd_qws.h:57
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int qint32
Definition: qglobal.h:937
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
static void handleWheelEvent(QWidget *w, const QPoint &local, const QPoint &global, int d, Qt::Orientation o)
struct termios m_tty_attr
Definition: qlinuxinput.h:103
#define SLOT(a)
Definition: qobjectdefs.h:226
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
#define O_RDONLY
static Qt::MouseButtons buttons
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QLinuxInputMouseHandler(const QString &key, const QString &specification)
QLinuxInputKeyboardHandler(const QString &key, const QString &specification)
#define QT_READ
Definition: qcore_unix_p.h:280
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList< struct TouchPoint > &points)
Q_CORE_EXPORT void qDebug(const char *,...)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static void handleMouseEvent(QWidget *w, const QPoint &local, const QPoint &global, Qt::MouseButtons b)
tlw == 0 means that ev is in global coords only
unsigned short quint16
Definition: qglobal.h:936
Q_CORE_EXPORT void qWarning(const char *,...)
virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value)
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
KeycodeAction
This enum describes the various special actions that actual QWSKeyboardHandler implementations have t...
Definition: qkbd_qws.h:67
QWSLinuxInputKeyboardHandler * m_handler
Definition: qlinuxinput.h:100
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
Qt::MouseButtons m_buttons
Definition: qlinuxinput.h:75
QLinuxInputMouseHandlerData * d
Definition: qlinuxinput.h:79
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
#define QT_OPEN
Definition: qcore_unix_p.h:186
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
int key
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
TouchPointState
This enum represents the state of a touch point at the time the QTouchEvent occurred.
Definition: qnamespace.h:1738
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
#define QT_WRITE
Definition: qcore_unix_p.h:289
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define qPrintable(string)
Definition: qglobal.h:1750
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat)
Maps keycode according to a keymap and sends that key event to the Qt for Embedded Linux server appli...
Definition: qkbd_qws.cpp:521
#define O_RDWR
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QSocketNotifier * m_notify
Definition: qlinuxinput.h:69
QWSLinuxInputKeyboardHandler(const QString &)
int errno
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static int area(const QSize &s)
Definition: qicon.cpp:155
void sendMouseEvent(int x, int y, Qt::MouseButtons buttons)
MouseButton
Definition: qnamespace.h:150
#define QT_CLOSE
Definition: qcore_unix_p.h:304
#define forever
This macro is provided for convenience for writing infinite loops.
Definition: qglobal.h:2452