2
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
5
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program 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
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "boxactionwidget.h"
21
#include "mainwindow.h"
24
BoxActionWidget::BoxActionWidget(QWidget *parent)
27
this->setFixedSize(900, 150);
28
this->setAutoFillBackground(true);
29
this->setObjectName("transparentWidget");
31
img_label = new QLabel();
32
title_label = new QLabel();
33
more_btn = new QPushButton();
35
img_label->setScaledContents(true);//自动缩放,显示图像大小自动调整为Qlabel大小
36
QPixmap label_pixmap("://res/toolkits.png");
37
img_label->setPixmap(label_pixmap);
38
img_label->setFixedSize(label_pixmap.size());
39
title_label->setObjectName("whiteLabel");
40
title_label->setWordWrap(true);//QLabel自动换行
41
more_btn->setFocusPolicy(Qt::NoFocus);
42
// more_btn->setObjectName("transparentButton");
43
more_btn->setObjectName("whiteButton");
45
// title_label->setFixedWidth(400);
46
title_label->setMinimumWidth(500);
47
title_label->setMaximumWidth(600);
50
QHBoxLayout *layout1 = new QHBoxLayout();
51
layout1->addWidget(img_label);
52
layout1->addWidget(title_label);
53
layout1->addWidget(more_btn);
54
layout1->addStretch();
55
layout1->setSpacing(15);
56
layout1->setContentsMargins(20, 20, 0, 0);
62
BoxActionWidget::~BoxActionWidget()
64
if(img_label != NULL) {
68
if(title_label != NULL) {
72
if(more_btn != NULL) {
79
void BoxActionWidget::setLanguage()
81
title_label->setText(tr("Provide a practical and lightweight tool, create fast and convenient experience for you"));//提供轻巧实用工具,为您打造快捷方便的体验
82
more_btn->setText(tr("More App"));