projects
/
multypo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9892f67
)
Change output color per label
author
Ralf Jung
<post@ralfj.de>
Wed, 17 Jul 2013 11:59:34 +0000
(13:59 +0200)
committer
Ralf Jung
<post@ralfj.de>
Wed, 17 Jul 2013 11:59:34 +0000
(13:59 +0200)
qt/multypo.cpp
patch
|
blob
|
history
diff --git
a/qt/multypo.cpp
b/qt/multypo.cpp
index 2584c0c7b1f7bca5635214db1eabf26ab2d9dab2..e7a188638008266ef5112d501bfd1d46024cdc27 100644
(file)
--- a/
qt/multypo.cpp
+++ b/
qt/multypo.cpp
@@
-9,12
+9,19
@@
#include <X11/extensions/XInput2.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
#include <X11/Xutil.h>
+static QString colorToString(QColor col)
+{
+ return QString("#%1%2%3").arg(col.red(), 2, 16, QChar('0'))
+ .arg(col.green(), 2, 16, QChar('0'))
+ .arg(col.blue(), 2, 16, QChar('0'));
+}
+
MultypoWindow::MultypoWindow(QWidget *parent) :
QWidget(parent),
xiInited(false)
{
/* Prepare colors */
MultypoWindow::MultypoWindow(QWidget *parent) :
QWidget(parent),
xiInited(false)
{
/* Prepare colors */
- setStyleSheet("background-color: black; color: green");
+ setStyleSheet("background-color: black; color: green
; font-size: 30pt
");
/* Prepare conents */
setLayout(new QVBoxLayout(this));
/* Prepare conents */
setLayout(new QVBoxLayout(this));
@@
-43,7
+50,8
@@
void MultypoWindow::handleKeyPress(int device, QString string)
layout()->addWidget(label);
players[device] = label;
}
layout()->addWidget(label);
players[device] = label;
}
- players[device]->setText(players[device]->text() + string);
+ QColor textColor = QColor(Qt::blue);
+ players[device]->setText(players[device]->text() + "<span style='color:"+colorToString(textColor)+"'>"+string+"</span>");
}
bool MultypoWindow::handleX11Event(XEvent *event)
}
bool MultypoWindow::handleX11Event(XEvent *event)