1 Star 0 Fork 1

AAA Elysia 猫猫侠 ⁧~喵/gxde-deb-installer

forked from GXDE OS/gxde-deb-installer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
infocontrolbutton.cpp 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
listenerri 提交于 2018-08-08 09:18 . add: dark theme
/*
* Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
*
* Maintainer: sbw <sbw@sbw.so>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "infocontrolbutton.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPixmap>
#include <QIcon>
InfoControlButton::InfoControlButton(const QString &expandTips, const QString &shrinkTips, QWidget *parent)
: QWidget(parent),
m_expand(false),
m_expandTips(expandTips),
m_shrinkTips(shrinkTips),
m_arrowIcon(new QLabel),
m_tipsText(new QLabel)
{
m_arrowIcon->setAlignment(Qt::AlignCenter);
m_arrowIcon->setPixmap(QIcon(":/images/arrow_up.svg").pixmap(21, 8));
m_tipsText->setAlignment(Qt::AlignCenter);
m_tipsText->setText(expandTips);
m_tipsText->setObjectName("TipsText");
QVBoxLayout *centralLayout = new QVBoxLayout;
centralLayout->addSpacing(2);
centralLayout->addWidget(m_arrowIcon);
centralLayout->addStretch();
centralLayout->addWidget(m_tipsText);
centralLayout->setSpacing(0);
centralLayout->setContentsMargins(0, 0, 0, 0);
setLayout(centralLayout);
setFixedSize(200, 33);
}
void InfoControlButton::mouseReleaseEvent(QMouseEvent *e)
{
QWidget::mouseReleaseEvent(e);
onMouseRelease();
}
void InfoControlButton::onMouseRelease()
{
if (m_expand)
emit shrink();
else
emit expand();
m_expand = !m_expand;
if (!m_expand)
{
m_arrowIcon->setPixmap(QIcon(":/images/arrow_up.svg").pixmap(21, 8));
m_tipsText->setText(m_expandTips);
setFixedSize(200, 33);
} else {
m_arrowIcon->setPixmap(QIcon(":/images/arrow_down.svg").pixmap(21, 8));
m_tipsText->setText(m_shrinkTips);
setFixedSize(200, 28);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qinyinan/gxde-deb-installer.git
git@gitee.com:qinyinan/gxde-deb-installer.git
qinyinan
gxde-deb-installer
gxde-deb-installer
master

搜索帮助