• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

libs/libksane/libksane

  • sources
  • kde-4.14
  • kdegraphics
  • libs
  • libksane
  • libksane
  • widgets
labeled_entry.cpp
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is part of the KDE project
4  *
5  * Date : 2007-09-13
6  * Description : Sane interface for KDE
7  *
8  * Copyright (C) 2007-2011 by Kare Sars <kare.sars@iki .fi>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) version 3, or any
14  * later version accepted by the membership of KDE e.V. (or its
15  * successor approved by the membership of KDE e.V.), which shall
16  * act as a proxy defined in Section 6 of version 3 of the license.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  * ============================================================ */
27 
28 // Local includes
29 #include "labeled_entry.h"
30 #include "labeled_entry.moc"
31 
32 // Qt includes
33 #include <QHBoxLayout>
34 #include <QLabel>
35 #include <KLineEdit>
36 #include <KLocale>
37 #include <QPushButton>
38 
39 namespace KSaneIface
40 {
41 
42 LabeledEntry::LabeledEntry(QWidget *parent, const QString& ltext)
43 : KSaneOptionWidget(parent, ltext)
44 {
45  m_entry = new KLineEdit(this);
46  m_reset = new QPushButton(this);
47  m_reset->setText(i18nc("Label for button to reset text in a KLineEdit", "Reset"));
48  m_set = new QPushButton(this);
49  m_set->setText(i18nc("Label for button to write text in a KLineEdit to sane", "Set"));
50 
51  m_layout->addWidget(m_entry, 1, 0, 1, 2);
52  m_layout->addWidget(m_reset, 1, 2);
53  m_layout->addWidget(m_set, 1, 3);
54  m_layout->setColumnStretch(1, 50);
55 
56  connect(m_reset, SIGNAL(clicked()), this, SLOT(resetClicked()));
57  connect(m_set, SIGNAL(clicked()), this, SLOT(setClicked()));
58 }
59 
60 LabeledEntry::~LabeledEntry()
61 {
62 }
63 
64 void LabeledEntry::setText(const QString& text)
65 {
66  m_eText = text;
67  m_entry->setText(text);
68 }
69 
70 void LabeledEntry::resetClicked()
71 {
72  m_entry->setText(m_eText);
73 }
74 
75 void LabeledEntry::setClicked()
76 {
77  m_eText = m_entry->text();
78  emit entryEdited(m_eText);
79 }
80 
81 } // NameSpace KSaneIface
QWidget
KSaneIface::LabeledEntry::LabeledEntry
LabeledEntry(QWidget *parent, const QString &text)
Create the entry.
Definition: labeled_entry.cpp:42
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
labeled_entry.h
KSaneIface::LabeledEntry::setText
void setText(const QString &text)
Definition: labeled_entry.cpp:64
KSaneIface::LabeledEntry::~LabeledEntry
~LabeledEntry()
Definition: labeled_entry.cpp:60
KSaneIface::KSaneOptionWidget::m_layout
QGridLayout * m_layout
Definition: ksane_option_widget.h:65
KSaneIface::KSaneOptionWidget
A wrapper for a checkbox.
Definition: ksane_option_widget.h:45
KSaneIface::LabeledEntry::entryEdited
void entryEdited(const QString &text)
QString
QGridLayout::setColumnStretch
void setColumnStretch(int column, int stretch)
QAbstractButton::setText
void setText(const QString &text)
QPushButton
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libs/libksane/libksane

Skip menu "libs/libksane/libksane"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal