source: calamares/trunk/fuentes/src/modules/partition/gui/PrettyRadioButton.cpp @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 1.9 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "PrettyRadioButton.h"
20
21#include "utils/CalamaresUtilsGui.h"
22#include "widgets/ClickableLabel.h"
23
24#include <QLabel>
25#include <QBoxLayout>
26
27
28PrettyRadioButton::PrettyRadioButton( QWidget* parent )
29    : QWidget( parent )
30{
31    QHBoxLayout* mainLayout = new QHBoxLayout;
32    setLayout( mainLayout );
33
34    m_radio = new QRadioButton;
35    m_label = new ClickableLabel;
36
37    connect( m_label, &ClickableLabel::clicked,
38             m_radio, &QRadioButton::click );
39    m_label->setBuddy( m_radio );
40
41    m_label->setWordWrap( true );
42    m_label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
43
44    mainLayout->addWidget( m_radio );
45    mainLayout->addWidget( m_label );
46    mainLayout->setContentsMargins( 0, 0, 0, 0 );
47}
48
49
50void
51PrettyRadioButton::setText( const QString& text )
52{
53    m_label->setText( text );
54}
55
56
57void
58PrettyRadioButton::setIconSize( const QSize& size )
59{
60    m_radio->setIconSize( size );
61}
62
63
64void
65PrettyRadioButton::setIcon( const QIcon& icon )
66{
67    m_radio->setIcon( icon );
68}
69
70
71QSize
72PrettyRadioButton::iconSize() const
73{
74    return m_radio->iconSize();
75}
76
77
78QRadioButton*
79PrettyRadioButton::buttonWidget() const
80{
81    return m_radio;
82}
Note: See TracBrowser for help on using the repository browser.