add a label to the UI
[multypo.git] / qt / multypo.cpp
index 6e461e3abb35d461027bcdf3ac3e0be4897aff99..a5d81375048e331c225eeb45add07f89dfc4fab7 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <QX11Info>
 #include <QDebug>
+#include <QHBoxLayout>
+#include <QLabel>
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XInput2.h>
@@ -11,7 +13,13 @@ MultypoWindow::MultypoWindow(QWidget *parent) :
        QWidget(parent),
        xiInited(false)
 {
-       
+       QHBoxLayout *layout = new QHBoxLayout(this);
+       setLayout(layout);
+
+       mainLabel = new QLabel(this);
+       layout->addWidget(mainLabel);
+
+       setMinimumSize(300, 300);
 }
 
 MultypoWindow::~MultypoWindow()
@@ -50,15 +58,12 @@ void MultypoWindow::showEvent ( QShowEvent * )
        XISelectEvents (dpy, winId(), &eventmask, 1);
 
        xiInited = true;
-
-       /*activateWindow();
-       raise();
-       setFocus(Qt::OtherFocusReason);*/
 }
 
 void MultypoWindow::handleKeyPress(int device, QString string)
 {
        qDebug() << "Device" << device << "String" << string;
+       mainLabel->setText(QString("%1 pressed on %2").arg(string).arg(device));
 }
 
 bool MultypoWindow::handleX11Event(XEvent *event)