Debian Codegraph @

kysdk-waylandhelper/test/testukuistylehelper/widget.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: Zhen Sun <[email protected]>
20 *
21 */
22
23 #include "widget.h"
24 #include "ukuistylehelper/ukuistylehelper.h"
25 #include "windowmanager/windowmanager.h"
26 #include <QApplication>
27 #include <QDebug>
28
29 Widget::Widget(QWidget *parent)
30 : QWidget(parent)
31 {
32 m_btn = new QPushButton("switch", this);
33 m_btn->setCheckable(true);
34 m_btn->move(100, 100);
35 m_testWidget = new QWidget();
36
37 QPushButton *btn = new QPushButton(this);
38 btn->move(200, 100);
39
40 connect(m_btn, &QPushButton::clicked, this, [=](bool checked) {
41 if (checked) {
42 kdk::UkuiStyleHelper::self()->removeHeader(m_testWidget);
43 m_testWidget->show();
44 } else
45 m_testWidget->hide();
46 });
47
48 connect(btn, &QPushButton::clicked, this, [=](bool checked) {
49 QPoint pos = m_testWidget->pos();
50 // m_testWidget->move(pos.x()-10,pos.y()-10);
51 m_testWidget->move(-100, -100);
52 });
53 }
54
55 Widget::~Widget()
56 {
57 }