Debian Codegraph @

kysdk-qtwidgets/src/klineeditframe.cpp

raw
1 /*
2 *
3 *
4 * Copyright (C) 2023, KylinSoft Co., Ltd.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this library. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Authors: Sisheng He <[email protected]>
20 *
21 */
22 #include "klineeditframe.h"
23
24 #include <QDebug>
25 namespace kdk
26 {
27
28 class KLineEditFramePrivate : public QObject
29 {
30 Q_OBJECT
31 Q_DECLARE_PUBLIC(KLineEditFrame)
32 public:
33 KLineEditFramePrivate(KLineEditFrame *parent);
34
35 private:
36 KLineEditFrame *q_ptr;
37 QLineEdit *m_pLineEdit;
38 KLabel *m_pSettingName;
39 QHBoxLayout *m_pMainLayout;
40 };
41
42 KLineEditFramePrivate::KLineEditFramePrivate(KLineEditFrame *parent)
43 : q_ptr(parent)
44 {
45 Q_Q(KLineEditFrame);
46 setParent(parent);
47 m_pMainLayout = new QHBoxLayout(q);
48 m_pMainLayout->setContentsMargins(16, 0, 16, 0);
49 m_pMainLayout->setSpacing(16);
50 m_pSettingName = new KLabel(q);
51 m_pSettingName->setFixedWidth(SETTING_LABEL_WIDTH);
52 m_pLineEdit = new QLineEdit(q);
53 m_pMainLayout->addWidget(m_pSettingName);
54 m_pMainLayout->addWidget(m_pLineEdit);
55 q->setLayout(m_pMainLayout);
56 }
57
58 KLineEditFrame::KLineEditFrame(const QString title, QWidget *parent, BorderRadiusStyle style)
59 : KBaseFrame(parent, style, true)
60 , d_ptr(new KLineEditFramePrivate(this))
61 {
62 Q_D(KLineEditFrame);
63 setObjectName("KLineEditFrame");
64 d->m_pSettingName->setText(title);
65 }
66
67 KLineEditFrame::~KLineEditFrame()
68 {
69 }
70
71 QLineEdit *KLineEditFrame::lineEdit()
72 {
73 Q_D(KLineEditFrame);
74 return d->m_pLineEdit;
75 }
76
77 QHBoxLayout *KLineEditFrame::mainHLayout()
78 {
79 Q_D(KLineEditFrame);
80 return d->m_pMainLayout;
81 }
82
83 KLabel *KLineEditFrame::titleLabel()
84 {
85 Q_D(KLineEditFrame);
86 return d->m_pSettingName;
87 }
88 }
89
90 #include "klineeditframe.moc"
91 #include "moc_klineeditframe.cpp"