Debian Codegraph @

kysdk-qtwidgets/test/testListWidget/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: Zhenyu Wang <[email protected]>
20 *
21 */
22
23 #include "widget.h"
24 #include <QVBoxLayout>
25
26 using namespace kdk;
27
28 Widget::Widget(QWidget *parent)
29 : QWidget(parent)
30 {
31 QVBoxLayout *vlayout = new QVBoxLayout(this);
32
33 m_listwidget = new KListWidget(this);
34 this->setWindowTitle("test");
35 this->setWindowIcon(QIcon::fromTheme("kylin-music"));
36 this->resize(800, 500);
37 // KItemWidget 构造函数 KItemWidget(const QIcon &Myicon,QString MmainText,QString MsecText,QWidget *parent);
38 // Myicon 需要显示的图片 MmainText 需要写入的miantext MsecText 需要写入的sectext
39 m_item = new KItemWidget(QIcon::fromTheme("kylin-music"), QString("IMG202202121544.JPG"), QString("1.6MB"), m_listwidget);
40
41 m_item1 = new KItemWidget(QIcon::fromTheme("kylin-music"), QString("IMG202202121544.JPG"), QString("1.5MB"), m_listwidget);
42 KItemWidget *m_item2 = new KItemWidget(QIcon::fromTheme("kylin-music"), QString("IMG202202121544.JPG"), QString("1.5MB"), m_listwidget);
43
44 m_listwidget->AddItemWidget(m_item);
45 m_listwidget->AddItemWidget(m_item1);
46 m_listwidget->AddItemWidget(m_item2);
47
48 vlayout->addWidget(m_listwidget);
49 }
50
51 Widget::~Widget()
52 {
53 }