File indexing completed on 2024-09-08 03:45:24
0001 /* 0002 SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "playerlabel.h" 0008 0009 #include <QHBoxLayout> 0010 0011 PlayerLabel::PlayerLabel(const QPixmap &icon, const QString &text, QWidget *parent) 0012 : QWidget(parent) 0013 { 0014 m_icon = new QLabel; 0015 m_icon->setPixmap(icon); 0016 0017 m_name = new QLabel; 0018 m_name->setText(text); 0019 0020 QHBoxLayout *layout = new QHBoxLayout; 0021 layout->addWidget(m_icon); 0022 layout->addSpacing(10); 0023 layout->addWidget(m_name); 0024 layout->addStretch(); 0025 0026 setLayout(layout); 0027 } 0028 0029 void PlayerLabel::setData(const QPixmap &icon, const QString &text) 0030 { 0031 m_icon->setPixmap(icon); 0032 m_name->setText(QLatin1String("<font size=\"5\">") + text + QLatin1String("</font>")); 0033 } 0034 0035 void PlayerLabel::setText(const QString &text) 0036 { 0037 m_name->setText(QLatin1String("<font size=\"5\">") + text + QLatin1String("</font>")); 0038 }