KSane

ksanebutton.cpp
1/*
2 * SPDX-FileCopyrightText: 2008-2011 Kare Sars <kare.sars@iki.fi>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#include "ksanebutton.h"
8
9namespace KSaneIface
10{
11
13 : KSaneOptionWidget(parent, QString())
14{
15 initButton(ltext);
16}
17
19 : KSaneOptionWidget(parent, option)
20{
21 initButton(option->title());
22 setToolTip(option->description());
23 connect(this, &KSaneButton::clicked, option, &KSaneCore::Option::setValue);
24}
25
26KSaneButton::~KSaneButton()
27{
28}
29
30void KSaneButton::initButton(const QString &text)
31{
32 m_button = new QPushButton(text, this);
33 m_layout->addWidget(m_button, 0, 1);
34 m_layout->addWidget(new QWidget(this), 0, 2);
35 m_layout->setColumnStretch(1, 0);
36 m_layout->setColumnStretch(2, 50);
37
38 connect(m_button, &QPushButton::clicked, this, &KSaneButton::clicked);
39}
40
41} // NameSpace KSaneIface
42
43#include "moc_ksanebutton.cpp"
bool setValue(const QVariant &value)
QString title() const
QString description() const
KSaneButton(QWidget *parent, const QString &text)
Create the checkbox.
Base class for option widgets.
void clicked(bool checked)
void addWidget(QWidget *widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment)
void setColumnStretch(int column, int stretch)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QWidget(QWidget *parent, Qt::WindowFlags f)
void setToolTip(const QString &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.