6 static QString colorToString(QColor col)
8 return QString("#%1%2%3").arg(col.red(), 2, 16, QChar('0'))
9 .arg(col.green(), 2, 16, QChar('0'))
10 .arg(col.blue(), 2, 16, QChar('0'));
13 Player::Player(QWidget* parent) : score(0) {
14 theLabel = new QLabel (parent);
15 parent->layout()->addWidget(theLabel);
17 qDebug() << "Player created";
20 bool Player::hasName() {
21 return !name.isEmpty();
24 QString Player::getName() {
28 QString Player::getCurrentLine() {
32 void Player::setWaiting(QString labeltext) {
33 theLabel->setText(labeltext);
37 void Player::resetText() {
39 theLabel->setText(currentLine);
43 bool Player::handleKey(QString str) {
47 if (str.length() == 1) {
50 } else if (!hasName() && str == "Return") {
54 } else if (str == "BackSpace") {
57 theLabel->setText(currentLine);