File indexing completed on 2024-05-12 16:44:05
0001 /* 0002 SPDX-FileCopyrightText: 2009-2010 Cristian Oneț <onet.cristian@gmail.com> 0003 SPDX-FileCopyrightText: 2009-2010 Alvaro Soliverez <asoliverez@gmail.com> 0004 SPDX-FileCopyrightText: 2011-2017 Thomas Baumgart <tbaumgart@kde.org> 0005 SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "ktaglabel.h" 0010 0011 // ---------------------------------------------------------------------------- 0012 // QT Includes 0013 0014 #include <QHBoxLayout> 0015 #include <QLabel> 0016 #include <QToolButton> 0017 0018 // ---------------------------------------------------------------------------- 0019 // KDE Includes 0020 0021 // ---------------------------------------------------------------------------- 0022 // Project Includes 0023 0024 #include "icons.h" 0025 0026 using namespace Icons; 0027 0028 KTagLabel::KTagLabel(const QString& id, const QString& name, QWidget* parent) : 0029 QFrame(parent) 0030 { 0031 QToolButton *t = new QToolButton(this); 0032 t->setIcon(Icons::get(Icon::DialogClose)); 0033 t->setAutoRaise(true); 0034 QLabel *l = new QLabel(name, this); 0035 m_tagId = id; 0036 QHBoxLayout *layout = new QHBoxLayout; 0037 layout->setContentsMargins(0, 0, 0, 0); 0038 layout->setSpacing(0); 0039 this->setLayout(layout); 0040 layout->addWidget(t); 0041 layout->addWidget(l); 0042 connect(t, &QAbstractButton::clicked, this, &KTagLabel::clicked); 0043 //this->setFrameStyle(QFrame::Panel | QFrame::Plain); 0044 }