1 Star 0 Fork 3

OPMichael/QTLauncher

forked from murphy/QTLauncher 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
wifilistbutton.cpp 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
murphy 提交于 2017-06-21 00:46 . init
#include "wifilistbutton.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPaintEvent>
#include <QPainter>
#include <QtDebug>
#include <QFont>
namespace ui {
WifiListButton::WifiListButton(WifiInfo info, QPixmap level, QWidget *parent)
:QPushButton(parent)
,mData(info)
{
QVBoxLayout *layout = new QVBoxLayout(this);
mItemLayout = new QHBoxLayout;
mSsidLabel = new QLabel(info.ssid.isEmpty() ? "null" : info.ssid);
mLevelPixmap = new QLabel;
mItemLayout->addWidget(mSsidLabel);
mItemLayout->addStretch(1);
mItemLayout->addWidget(mLevelPixmap);
layout->addLayout(mItemLayout);
mLevelPixmap->setPixmap(level);
QFont font = mSsidLabel->font();
font.setPointSize(7);
mSsidLabel->setFont(font);
mSsidLabel->setStyleSheet("color:white");
mItemLayout->setContentsMargins(20, 0, 20, 0);
setFocusPolicy(Qt::StrongFocus);
//connect(this, SIGNAL(clicked()), SLOT(onClicked()));
setFlat(true);
setFixedHeight(60);
}
WifiListButton::~WifiListButton()
{
delete mItemLayout;
delete mSsidLabel;
delete mLevelPixmap;
}
void WifiListButton::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.drawPixmap(0, 0, QPixmap(":/icons/wifibutton_background.png").scaled(size()));
QPushButton::paintEvent(event);
}
#if 0
void WifiListButton::onClicked()
{
qDebug() << __FILE__ << __func__ << __LINE__;
emit active();
}
#endif
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/michaelheaven/qtlauncher.git
git@gitee.com:michaelheaven/qtlauncher.git
michaelheaven
qtlauncher
QTLauncher
master

搜索帮助