Debian Codegraph @

kysdk-qtwidgets/test/testlineedit/widget.cpp

raw
1 /*
2 *
3 * Copyright (C) 2024, KylinSoft Co., Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 3 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this library. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * Authors: Zhenyu Wang <[email protected]>
19 *
20 */
21
22 #include "widget.h"
23 #include "klineedit.h"
24 #include <QBoxLayout>
25 #include <QDebug>
26 #include <QPushButton>
27
28 using namespace kdk;
29 Widget::Widget(QWidget *parent)
30 : QWidget(parent)
31 {
32 QVBoxLayout *vlayout = new QVBoxLayout(this);
33
34 KLineEdit *edit = new KLineEdit(this);
35
36 QPushButton *btn = edit->pushbutton();
37 btn->setIcon(QIcon::fromTheme("system-computer-symbolic"));
38 connect(btn, &QPushButton::clicked, this, [=] {
39 qDebug() << edit->text();
40 });
41 vlayout->addWidget(edit);
42
43 QPushButton *btn1 = new QPushButton(this);
44 vlayout->addWidget(btn1);
45 }
46
47 Widget::~Widget()
48 {
49 }