feat: 初始化control模块代码

master
laixingyu 3 years ago
parent 346e848f2b
commit 779ab69ff5

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@ -0,0 +1,421 @@
#pragma execution_character_set("utf-8")
#include "battery.h"
#include "qpainter.h"
#include "qtimer.h"
#include "qdebug.h"
Battery::Battery(QWidget *parent) : QWidget(parent)
{
minValue = 0;
maxValue = 100;
value = 0;
alarmValue = 30;
animation = true;
animationStep = 0.5;
borderWidth = 5;
borderRadius = 8;
bgRadius = 5;
headRadius = 3;
borderColorStart = QColor(100, 100, 100);
borderColorEnd = QColor(80, 80, 80);
alarmColorStart = QColor(250, 118, 113);
alarmColorEnd = QColor(204, 38, 38);
normalColorStart = QColor(50, 205, 51);
normalColorEnd = QColor(60, 179, 133);
isForward = false;
currentValue = 0;
timer = new QTimer(this);
timer->setInterval(10);
connect(timer, SIGNAL(timeout()), this, SLOT(updateValue()));
}
Battery::~Battery()
{
if (timer->isActive()) {
timer->stop();
}
}
void Battery::paintEvent(QPaintEvent *)
{
//绘制准备工作,启用反锯齿
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
//绘制边框
drawBorder(&painter);
//绘制背景
drawBg(&painter);
//绘制头部
drawHead(&painter);
}
void Battery::drawBorder(QPainter *painter)
{
painter->save();
double headWidth = width() / 15;
double batteryWidth = width() - headWidth;
//绘制电池边框
QPointF topLeft(borderWidth, borderWidth);
QPointF bottomRight(batteryWidth, height() - borderWidth);
batteryRect = QRectF(topLeft, bottomRight);
painter->setPen(QPen(borderColorStart, borderWidth));
painter->setBrush(Qt::NoBrush);
painter->drawRoundedRect(batteryRect, borderRadius, borderRadius);
painter->restore();
}
void Battery::drawBg(QPainter *painter)
{
if (value == minValue) {
return;
}
painter->save();
QLinearGradient batteryGradient(QPointF(0, 0), QPointF(0, height()));
if (currentValue <= alarmValue) {
batteryGradient.setColorAt(0.0, alarmColorStart);
batteryGradient.setColorAt(1.0, alarmColorEnd);
} else {
batteryGradient.setColorAt(0.0, normalColorStart);
batteryGradient.setColorAt(1.0, normalColorEnd);
}
int margin = qMin(width(), height()) / 20;
double unit = (batteryRect.width() - (margin * 2)) / (maxValue - minValue);
double width = currentValue * unit;
QPointF topLeft(batteryRect.topLeft().x() + margin, batteryRect.topLeft().y() + margin);
QPointF bottomRight(width + margin + borderWidth, batteryRect.bottomRight().y() - margin);
QRectF rect(topLeft, bottomRight);
painter->setPen(Qt::NoPen);
painter->setBrush(batteryGradient);
painter->drawRoundedRect(rect, bgRadius, bgRadius);
painter->restore();
}
void Battery::drawHead(QPainter *painter)
{
painter->save();
QPointF headRectTopLeft(batteryRect.topRight().x(), height() / 3);
QPointF headRectBottomRight(width(), height() - height() / 3);
QRectF headRect(headRectTopLeft, headRectBottomRight);
QLinearGradient headRectGradient(headRect.topLeft(), headRect.bottomLeft());
headRectGradient.setColorAt(0.0, borderColorStart);
headRectGradient.setColorAt(1.0, borderColorEnd);
painter->setPen(Qt::NoPen);
painter->setBrush(headRectGradient);
painter->drawRoundedRect(headRect, headRadius, headRadius);
painter->restore();
}
void Battery::updateValue()
{
if (isForward) {
currentValue -= animationStep;
if (currentValue <= value) {
currentValue = value;
timer->stop();
}
} else {
currentValue += animationStep;
if (currentValue >= value) {
currentValue = value;
timer->stop();
}
}
this->update();
}
QSize Battery::sizeHint() const
{
return QSize(150, 80);
}
QSize Battery::minimumSizeHint() const
{
return QSize(30, 10);
}
void Battery::setRange(double minValue, double maxValue)
{
//如果最小值大于或者等于最大值则不设置
if (minValue >= maxValue) {
return;
}
this->minValue = minValue;
this->maxValue = maxValue;
//如果目标值不在范围值内,则重新设置目标值
//值小于最小值则取最小值,大于最大值则取最大值
if (value < minValue) {
setValue(minValue);
} else if (value > maxValue) {
setValue(maxValue);
}
this->update();
}
void Battery::setRange(int minValue, int maxValue)
{
setRange((double)minValue, (double)maxValue);
}
double Battery::getMinValue() const
{
return this->minValue;
}
void Battery::setMinValue(double minValue)
{
setRange(minValue, maxValue);
}
double Battery::getMaxValue() const
{
return this->maxValue;
}
void Battery::setMaxValue(double maxValue)
{
setRange(minValue, maxValue);
}
double Battery::getValue() const
{
return this->value;
}
void Battery::setValue(double value)
{
//值和当前值一致则无需处理
if (value == this->value) {
return;
}
//值小于最小值则取最小值,大于最大值则取最大值
if (value < minValue) {
value = minValue;
} else if (value > maxValue) {
value = maxValue;
}
if (value > currentValue) {
isForward = false;
} else if (value < currentValue) {
isForward = true;
} else {
this->value = value;
this->update();
return;
}
this->value = value;
Q_EMIT valueChanged(value);
if (animation) {
timer->stop();
timer->start();
} else {
this->currentValue = value;
this->update();
}
}
void Battery::setValue(int value)
{
setValue((double)value);
}
double Battery::getAlarmValue() const
{
return this->alarmValue;
}
void Battery::setAlarmValue(double alarmValue)
{
if (this->alarmValue != alarmValue) {
this->alarmValue = alarmValue;
this->update();
}
}
void Battery::setAlarmValue(int alarmValue)
{
setAlarmValue((double)alarmValue);
}
bool Battery::getAnimation() const
{
return this->animation;
}
void Battery::setAnimation(bool animation)
{
if (this->animation != animation) {
this->animation = animation;
this->update();
}
}
double Battery::getAnimationStep() const
{
return this->animationStep;
}
void Battery::setAnimationStep(double animationStep)
{
if (this->animationStep != animationStep) {
this->animationStep = animationStep;
this->update();
}
}
int Battery::getBorderWidth() const
{
return this->borderWidth;
}
void Battery::setBorderWidth(int borderWidth)
{
if (this->borderWidth != borderWidth) {
this->borderWidth = borderWidth;
this->update();
}
}
int Battery::getBorderRadius() const
{
return this->borderRadius;
}
void Battery::setBorderRadius(int borderRadius)
{
if (this->borderRadius != borderRadius) {
this->borderRadius = borderRadius;
this->update();
}
}
int Battery::getBgRadius() const
{
return this->bgRadius;
}
void Battery::setBgRadius(int bgRadius)
{
if (this->bgRadius != bgRadius) {
this->bgRadius = bgRadius;
this->update();
}
}
int Battery::getHeadRadius() const
{
return this->headRadius;
}
void Battery::setHeadRadius(int headRadius)
{
if (this->headRadius != headRadius) {
this->headRadius = headRadius;
this->update();
}
}
QColor Battery::getBorderColorStart() const
{
return this->borderColorStart;
}
void Battery::setBorderColorStart(const QColor &borderColorStart)
{
if (this->borderColorStart != borderColorStart) {
this->borderColorStart = borderColorStart;
this->update();
}
}
QColor Battery::getBorderColorEnd() const
{
return this->borderColorEnd;
}
void Battery::setBorderColorEnd(const QColor &borderColorEnd)
{
if (this->borderColorEnd != borderColorEnd) {
this->borderColorEnd = borderColorEnd;
this->update();
}
}
QColor Battery::getAlarmColorStart() const
{
return this->alarmColorStart;
}
void Battery::setAlarmColorStart(const QColor &alarmColorStart)
{
if (this->alarmColorStart != alarmColorStart) {
this->alarmColorStart = alarmColorStart;
this->update();
}
}
QColor Battery::getAlarmColorEnd() const
{
return this->alarmColorEnd;
}
void Battery::setAlarmColorEnd(const QColor &alarmColorEnd)
{
if (this->alarmColorEnd != alarmColorEnd) {
this->alarmColorEnd = alarmColorEnd;
this->update();
}
}
QColor Battery::getNormalColorStart() const
{
return this->normalColorStart;
}
void Battery::setNormalColorStart(const QColor &normalColorStart)
{
if (this->normalColorStart != normalColorStart) {
this->normalColorStart = normalColorStart;
this->update();
}
}
QColor Battery::getNormalColorEnd() const
{
return this->normalColorEnd;
}
void Battery::setNormalColorEnd(const QColor &normalColorEnd)
{
if (this->normalColorEnd != normalColorEnd) {
this->normalColorEnd = normalColorEnd;
this->update();
}
}

@ -0,0 +1,166 @@
#ifndef BATTERY_H
#define BATTERY_H
/**
* :feiyangqingyun(QQ:517216493) 2016-10-23
* 1.
* 2.
* 3.
* 4.
* 5.
* 6.
*/
#include <QWidget>
#ifdef quc
class Q_DECL_EXPORT Battery : public QWidget
#else
class Battery : public QWidget
#endif
{
Q_OBJECT
Q_PROPERTY(double minValue READ getMinValue WRITE setMinValue)
Q_PROPERTY(double maxValue READ getMaxValue WRITE setMaxValue)
Q_PROPERTY(double value READ getValue WRITE setValue)
Q_PROPERTY(double alarmValue READ getAlarmValue WRITE setAlarmValue)
Q_PROPERTY(bool animation READ getAnimation WRITE setAnimation)
Q_PROPERTY(double animationStep READ getAnimationStep WRITE setAnimationStep)
Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth)
Q_PROPERTY(int borderRadius READ getBorderRadius WRITE setBorderRadius)
Q_PROPERTY(int bgRadius READ getBgRadius WRITE setBgRadius)
Q_PROPERTY(int headRadius READ getHeadRadius WRITE setHeadRadius)
Q_PROPERTY(QColor borderColorStart READ getBorderColorStart WRITE setBorderColorStart)
Q_PROPERTY(QColor borderColorEnd READ getBorderColorEnd WRITE setBorderColorEnd)
Q_PROPERTY(QColor alarmColorStart READ getAlarmColorStart WRITE setAlarmColorStart)
Q_PROPERTY(QColor alarmColorEnd READ getAlarmColorEnd WRITE setAlarmColorEnd)
Q_PROPERTY(QColor normalColorStart READ getNormalColorStart WRITE setNormalColorStart)
Q_PROPERTY(QColor normalColorEnd READ getNormalColorEnd WRITE setNormalColorEnd)
public:
explicit Battery(QWidget *parent = 0);
~Battery();
protected:
void paintEvent(QPaintEvent *);
void drawBorder(QPainter *painter);
void drawBg(QPainter *painter);
void drawHead(QPainter *painter);
private slots:
void updateValue();
private:
double minValue; //最小值
double maxValue; //最大值
double value; //目标电量
double alarmValue; //电池电量警戒值
bool animation; //是否启用动画显示
double animationStep; //动画显示时步长
int borderWidth; //边框粗细
int borderRadius; //边框圆角角度
int bgRadius; //背景进度圆角角度
int headRadius; //头部圆角角度
QColor borderColorStart;//边框渐变开始颜色
QColor borderColorEnd; //边框渐变结束颜色
QColor alarmColorStart; //电池低电量时的渐变开始颜色
QColor alarmColorEnd; //电池低电量时的渐变结束颜色
QColor normalColorStart;//电池正常电量时的渐变开始颜色
QColor normalColorEnd; //电池正常电量时的渐变结束颜色
bool isForward; //是否往前移
double currentValue; //当前电量
QRectF batteryRect; //电池主体区域
QTimer *timer; //绘制定时器
public:
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
//设置范围值
void setRange(double minValue, double maxValue);
void setRange(int minValue, int maxValue);
//获取和设置最小值
double getMinValue() const;
void setMinValue(double minValue);
//获取和设置最大值
double getMaxValue() const;
void setMaxValue(double maxValue);
//获取和设置电池电量值
double getValue() const;
void setValue(double value);
//获取和设置电池电量警戒值
double getAlarmValue() const;
void setAlarmValue(double alarmValue);
//获取和设置是否启用动画显示
bool getAnimation() const;
void setAnimation(bool animation);
//获取和设置动画显示的步长
double getAnimationStep() const;
void setAnimationStep(double animationStep);
//获取和设置边框粗细
int getBorderWidth() const;
void setBorderWidth(int borderWidth);
//获取和设置边框圆角角度
int getBorderRadius() const;
void setBorderRadius(int borderRadius);
//获取和设置背景圆角角度
int getBgRadius() const;
void setBgRadius(int bgRadius);
//获取和设置头部圆角角度
int getHeadRadius() const;
void setHeadRadius(int headRadius);
//获取和设置边框渐变颜色
QColor getBorderColorStart() const;
void setBorderColorStart(const QColor &borderColorStart);
QColor getBorderColorEnd() const;
void setBorderColorEnd(const QColor &borderColorEnd);
//获取和设置电池电量报警时的渐变颜色
QColor getAlarmColorStart() const;
void setAlarmColorStart(const QColor &alarmColorStart);
QColor getAlarmColorEnd() const;
void setAlarmColorEnd(const QColor &alarmColorEnd);
//获取和设置电池电量正常时的渐变颜色
QColor getNormalColorStart() const;
void setNormalColorStart(const QColor &normalColorStart);
QColor getNormalColorEnd() const;
void setNormalColorEnd(const QColor &normalColorEnd);
public Q_SLOTS:
void setValue(int value);
void setAlarmValue(int alarmValue);
Q_SIGNALS:
void valueChanged(double value);
};
#endif // BATTERY_H

@ -0,0 +1,17 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = battery
TEMPLATE = app
DESTDIR = $$PWD/../bin
CONFIG += warn_off
SOURCES += main.cpp
SOURCES += frmbattery.cpp
SOURCES += battery.cpp
HEADERS += frmbattery.h
HEADERS += battery.h
FORMS += frmbattery.ui

@ -0,0 +1,21 @@
#pragma execution_character_set("utf-8")
#include "frmbattery.h"
#include "ui_frmbattery.h"
frmBattery::frmBattery(QWidget *parent) : QWidget(parent), ui(new Ui::frmBattery)
{
ui->setupUi(this);
this->initForm();
}
frmBattery::~frmBattery()
{
delete ui;
}
void frmBattery::initForm()
{
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->battery, SLOT(setValue(int)));
ui->horizontalSlider->setValue(30);
}

@ -0,0 +1,25 @@
#ifndef FRMBATTERY_H
#define FRMBATTERY_H
#include <QWidget>
namespace Ui {
class frmBattery;
}
class frmBattery : public QWidget
{
Q_OBJECT
public:
explicit frmBattery(QWidget *parent = 0);
~frmBattery();
private:
Ui::frmBattery *ui;
private slots:
void initForm();
};
#endif // FRMBATTERY_H

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frmBattery</class>
<widget class="QWidget" name="frmBattery">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="Battery" name="battery" native="true">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>482</width>
<height>257</height>
</rect>
</property>
</widget>
<widget class="QSlider" name="horizontalSlider">
<property name="geometry">
<rect>
<x>9</x>
<y>272</y>
<width>481</width>
<height>19</height>
</rect>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>Battery</class>
<extends>QWidget</extends>
<header>battery.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

@ -0,0 +1,34 @@
#pragma execution_character_set("utf-8")
#include "frmbattery.h"
#include <QApplication>
#include <QTextCodec>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFont font;
font.setFamily("Microsoft Yahei");
font.setPixelSize(13);
a.setFont(font);
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
#if _MSC_VER
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else
QTextCodec *codec = QTextCodec::codecForName("utf-8");
#endif
QTextCodec::setCodecForLocale(codec);
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForTr(codec);
#else
QTextCodec *codec = QTextCodec::codecForName("utf-8");
QTextCodec::setCodecForLocale(codec);
#endif
frmBattery w;
w.setWindowTitle("电池电量控件 (QQ: 517216493 WX: feiyangqingyun)");
w.show();
return a.exec();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,13 @@
TEMPLATE = subdirs
SUBDIRS += battery
SUBDIRS += devicebutton
SUBDIRS += devicesizetable
SUBDIRS += imageswitch
SUBDIRS += ipaddress
SUBDIRS += lightbutton
SUBDIRS += navbutton
SUBDIRS += savelog
SUBDIRS += saveruntime
SUBDIRS += smoothcurve
SUBDIRS += zhtopy
SUBDIRS += cpumemorylabel

@ -0,0 +1,239 @@
#pragma execution_character_set("utf-8")
#include "cpumemorylabel.h"
#include "qtimer.h"
#include "qprocess.h"
#include "qdebug.h"
#ifdef Q_OS_WIN
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x502
#endif
#include "windows.h"
#endif
#define MB (1024 * 1024)
#define KB (1024)
CpuMemoryLabel::CpuMemoryLabel(QWidget *parent) : QLabel(parent)
{
totalNew = idleNew = totalOld = idleOld = 0;
cpuPercent = 0;
memoryPercent = 0;
memoryAll = 0;
memoryUse = 0;
//获取CPU占用情况定时器
timerCPU = new QTimer(this);
connect(timerCPU, SIGNAL(timeout()), this, SLOT(getCPU()));
//获取内存占用情况定时器
timerMemory = new QTimer(this);
connect(timerMemory, SIGNAL(timeout()), this, SLOT(getMemory()));
//执行命令获取
process = new QProcess(this);
connect(process, SIGNAL(readyRead()), this, SLOT(readData()));
showText = true;
}
CpuMemoryLabel::~CpuMemoryLabel()
{
this->stop();
}
void CpuMemoryLabel::start(int interval)
{
this->getCPU();
this->getMemory();
if (!timerCPU->isActive()) {
timerCPU->start(interval);
}
if (!timerMemory->isActive()) {
timerMemory->start(interval + 1000);
}
}
void CpuMemoryLabel::stop()
{
process->close();
if (timerCPU->isActive()) {
timerCPU->stop();
}
if (timerMemory->isActive()) {
timerMemory->stop();
}
}
void CpuMemoryLabel::getCPU()
{
#ifdef Q_OS_WIN
#if 0
static FILETIME lastIdleTime;
static FILETIME lastKernelTime;
static FILETIME lastUserTime;
FILETIME newIdleTime;
FILETIME newKernelTime;
FILETIME newUserTime;
//采用GetSystemTimes获取的CPU占用和任务管理器的不一致
GetSystemTimes(&newIdleTime, &newKernelTime, &newUserTime);
int offset = 31;
quint64 a, b;
quint64 idle, kernel, user;
a = (lastIdleTime.dwHighDateTime << offset) | lastIdleTime.dwLowDateTime;
b = (newIdleTime.dwHighDateTime << offset) | newIdleTime.dwLowDateTime;
idle = b - a;
a = (lastKernelTime.dwHighDateTime << offset) | lastKernelTime.dwLowDateTime;
b = (newKernelTime.dwHighDateTime << offset) | newKernelTime.dwLowDateTime;
kernel = b - a;
a = (lastUserTime.dwHighDateTime << offset) | lastUserTime.dwLowDateTime;
b = (newUserTime.dwHighDateTime << offset) | newUserTime.dwLowDateTime;
user = b - a;
cpuPercent = float(kernel + user - idle) * 100 / float(kernel + user);
lastIdleTime = newIdleTime;
lastKernelTime = newKernelTime;
lastUserTime = newUserTime;
this->setData();
#else
//获取系统版本区分win10
bool win10 = false;
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
win10 = (QSysInfo::productVersion().mid(0, 2).toInt() >= 10);
#else
win10 = (QSysInfo::WindowsVersion >= 192);
#endif
QString cmd = "\\Processor(_Total)\\% Processor Time";
if (win10) {
cmd = "\\Processor Information(_Total)\\% Processor Utility";
}
if (process->state() == QProcess::NotRunning) {
process->start("typeperf", QStringList() << cmd);
}
#endif
#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
if (process->state() == QProcess::NotRunning) {
totalNew = idleNew = 0;
process->start("cat", QStringList() << "/proc/stat");
}
#endif
}
void CpuMemoryLabel::getMemory()
{
#ifdef Q_OS_WIN
MEMORYSTATUSEX statex;
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
memoryPercent = statex.dwMemoryLoad;
memoryAll = statex.ullTotalPhys / MB;
memoryFree = statex.ullAvailPhys / MB;
memoryUse = memoryAll - memoryFree;
this->setData();
#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
if (process->state() == QProcess::NotRunning) {
process->start("cat", QStringList() << "/proc/meminfo");
}
#endif
}
void CpuMemoryLabel::readData()
{
#ifdef Q_OS_WIN
while (!process->atEnd()) {
QString s = QLatin1String(process->readLine());
s = s.split(",").last();
s.replace("\r", "");
s.replace("\n", "");
s.replace("\"", "");
if (!s.isEmpty() && s.length() < 10) {
cpuPercent = qRound(s.toFloat());
}
}
#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
while (!process->atEnd()) {
QString s = QLatin1String(process->readLine());
if (s.startsWith("cpu")) {
QStringList list = s.split(" ");
idleNew = list.at(5).toUInt();
foreach (QString value, list) {
totalNew += value.toUInt();
}
quint64 total = totalNew - totalOld;
quint64 idle = idleNew - idleOld;
cpuPercent = 100 * (total - idle) / total;
totalOld = totalNew;
idleOld = idleNew;
break;
} else if (s.startsWith("MemTotal")) {
s.replace(" ", "");
s = s.split(":").at(1);
memoryAll = s.left(s.length() - 3).toUInt() / KB;
} else if (s.startsWith("MemFree")) {
s.replace(" ", "");
s = s.split(":").at(1);
memoryFree = s.left(s.length() - 3).toUInt() / KB;
} else if (s.startsWith("Buffers")) {
s.replace(" ", "");
s = s.split(":").at(1);
memoryFree += s.left(s.length() - 3).toUInt() / KB;
} else if (s.startsWith("Cached")) {
s.replace(" ", "");
s = s.split(":").at(1);
memoryFree += s.left(s.length() - 3).toUInt() / KB;
memoryUse = memoryAll - memoryFree;
memoryPercent = 100 * memoryUse / memoryAll;
break;
}
}
#endif
this->setData();
}
void CpuMemoryLabel::setData()
{
cpuPercent = (cpuPercent < 0 ? 0 : cpuPercent);
cpuPercent = (cpuPercent > 100 ? 0 : cpuPercent);
QString msg = QString("CPU %1% Mem %2% ( 已用 %3 MB / 共 %4 MB )").arg(cpuPercent).arg(memoryPercent).arg(memoryUse).arg(memoryAll);
if (showText) {
this->setText(msg);
}
Q_EMIT textChanged(msg);
Q_EMIT valueChanged(cpuPercent, memoryPercent, memoryAll, memoryUse, memoryFree);
}
QSize CpuMemoryLabel::sizeHint() const
{
return QSize(300, 30);
}
QSize CpuMemoryLabel::minimumSizeHint() const
{
return QSize(30, 10);
}
bool CpuMemoryLabel::getShowText() const
{
return this->showText;
}
void CpuMemoryLabel::setShowText(bool showText)
{
this->showText = showText;
}

@ -0,0 +1,75 @@
#ifndef CPUMEMORYLABEL_H
#define CPUMEMORYLABEL_H
/**
* CPU :feiyangqingyun(QQ:517216493) 2016-11-18
* 1. CPU
* 2. 使
* 3. 使
* 4. windowslinuxARM
* 5. 使便
*/
#include <QLabel>
class QProcess;
#ifdef quc
class Q_DECL_EXPORT CpuMemoryLabel : public QLabel
#else
class CpuMemoryLabel : public QLabel
#endif
{
Q_OBJECT
Q_PROPERTY(bool showText READ getShowText WRITE setShowText)
public:
explicit CpuMemoryLabel(QWidget *parent = 0);
~CpuMemoryLabel();
private:
quint64 totalNew, idleNew, totalOld, idleOld;
quint64 cpuPercent; //CPU百分比
quint64 memoryPercent; //内存百分比
quint64 memoryAll; //所有内存
quint64 memoryUse; //已用内存
quint64 memoryFree; //空闲内存
QTimer *timerCPU; //定时器获取CPU信息
QTimer *timerMemory; //定时器获取内存信息
QProcess *process; //执行命令行
bool showText; //自己显示值
private slots:
void getCPU(); //获取cpu
void getMemory(); //获取内存
void readData(); //读取数据
void setData(); //设置数据
public:
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
//获取和设置是否显示文本
bool getShowText() const;
void setShowText(bool showText);
public Q_SLOTS:
//开始启动服务
void start(int interval);
//停止服务
void stop();
Q_SIGNALS:
//文本改变信号
void textChanged(const QString &text);
//cpu和内存占用情况数值改变信号
void valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree);
};
#endif // CPUMEMORYLABEL_H

@ -0,0 +1,17 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = cpumemorylabel
TEMPLATE = app
DESTDIR = $$PWD/../bin
CONFIG += warn_off
SOURCES += main.cpp
SOURCES += frmcpumemorylabel.cpp
SOURCES += cpumemorylabel.cpp
HEADERS += frmcpumemorylabel.h
HEADERS += cpumemorylabel.h
FORMS += frmcpumemorylabel.ui

@ -0,0 +1,42 @@
#pragma execution_character_set("utf-8")
#include "frmcpumemorylabel.h"
#include "ui_frmcpumemorylabel.h"
frmCpuMemoryLabel::frmCpuMemoryLabel(QWidget *parent) : QWidget(parent), ui(new Ui::frmCpuMemoryLabel)
{
ui->setupUi(this);
this->initForm();
}
frmCpuMemoryLabel::~frmCpuMemoryLabel()
{
delete ui;
}
void frmCpuMemoryLabel::initForm()
{
QFont font;
font.setPixelSize(16);
setFont(font);
QString qss1 = QString("QLabel{background-color:rgb(0,0,0);color:rgb(%1);}").arg("100,184,255");
QString qss2 = QString("QLabel{background-color:rgb(0,0,0);color:rgb(%1);}").arg("255,107,107");
QString qss3 = QString("QLabel{background-color:rgb(0,0,0);color:rgb(%1);}").arg("24,189,155");
ui->label1->setStyleSheet(qss1);
ui->label2->setStyleSheet(qss2);
ui->label3->setStyleSheet(qss3);
connect(ui->label1, SIGNAL(textChanged(QString)), ui->label2, SLOT(setText(QString)));
connect(ui->label1, SIGNAL(valueChanged(quint64, quint64, quint64, quint64, quint64)),
this, SLOT(valueChanged(quint64, quint64, quint64, quint64, quint64)));
ui->label1->start(1000);
}
void frmCpuMemoryLabel::valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree)
{
//重新组织文字
QString msg = QString("CPU: %1% 内存: %2% ( %3 MB / %4 MB )").arg(cpuPercent).arg(memoryPercent).arg(memoryUse).arg(memoryAll);
ui->label3->setText(msg);
}

@ -0,0 +1,27 @@
#ifndef FRMCPUMEMORYLABEL_H
#define FRMCPUMEMORYLABEL_H
#include <QWidget>
namespace Ui {
class frmCpuMemoryLabel;
}
class frmCpuMemoryLabel : public QWidget
{
Q_OBJECT
public:
explicit frmCpuMemoryLabel(QWidget *parent = 0);
~frmCpuMemoryLabel();
private:
Ui::frmCpuMemoryLabel *ui;
private slots:
void initForm();
//cpu和内存占用情况数值改变信号
void valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree);
};
#endif // FRMCPUMEMORYLABEL_H

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frmCpuMemoryLabel</class>
<widget class="QWidget" name="frmCpuMemoryLabel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="CpuMemoryLabel" name="label1">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label2">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label3">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CpuMemoryLabel</class>
<extends>QLabel</extends>
<header>cpumemorylabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

@ -0,0 +1,34 @@
#pragma execution_character_set("utf-8")
#include "frmcpumemorylabel.h"
#include <QApplication>
#include <QTextCodec>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFont font;
font.setFamily("Microsoft Yahei");
font.setPixelSize(13);
a.setFont(font);
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
#if _MSC_VER
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else
QTextCodec *codec = QTextCodec::codecForName("utf-8");
#endif
QTextCodec::setCodecForLocale(codec);
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForTr(codec);
#else
QTextCodec *codec = QTextCodec::codecForName("utf-8");
QTextCodec::setCodecForLocale(codec);
#endif
frmCpuMemoryLabel w;
w.setWindowTitle("CPU内存显示控件 (QQ: 517216493 WX: feiyangqingyun)");
w.show();
return a.exec();
}

@ -0,0 +1,258 @@
#pragma execution_character_set("utf-8")
#include "devicebutton.h"
#include "qpainter.h"
#include "qevent.h"
#include "qtimer.h"
#include "qdebug.h"
DeviceButton::DeviceButton(QWidget *parent) : QWidget(parent)
{
canMove = false;
text = "1";
colorNormal = "black";
colorAlarm = "red";
buttonStyle = ButtonStyle_Police;
buttonColor = ButtonColor_Green;
isPressed = false;
lastPoint = QPoint();
type = "police";
imgPath = ":/image/devicebutton/devicebutton";
imgName = QString("%1_green_%2.png").arg(imgPath).arg(type);
isDark = false;
timer = new QTimer(this);
timer->setInterval(500);
connect(timer, SIGNAL(timeout()), this, SLOT(checkAlarm()));
this->installEventFilter(this);
}
DeviceButton::~DeviceButton()
{
if (timer->isActive()) {
timer->stop();
}
}
void DeviceButton::paintEvent(QPaintEvent *)
{
double width = this->width();
double height = this->height();
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
//绘制背景图
QImage img(imgName);
if (!img.isNull()) {
img = img.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
painter.drawImage(0, 0, img);
}
//计算字体
QFont font;
font.setPixelSize(height * 0.37);
font.setBold(true);
//自动计算文字绘制区域,绘制防区号
QRectF rect = this->rect();
if (buttonStyle == ButtonStyle_Police) {
double y = (30 * height / 60);
rect = QRectF(0, y, width, height - y);
} else if (buttonStyle == ButtonStyle_Bubble) {
double y = (8 * height / 60);
rect = QRectF(0, 0, width, height - y);
} else if (buttonStyle == ButtonStyle_Bubble2) {
double y = (13 * height / 60);
rect = QRectF(0, 0, width, height - y);
font.setPixelSize(width * 0.33);
} else if (buttonStyle == ButtonStyle_Msg) {
double y = (17 * height / 60);
rect = QRectF(0, 0, width, height - y);
} else if (buttonStyle == ButtonStyle_Msg2) {
double y = (17 * height / 60);
rect = QRectF(0, 0, width, height - y);
}
//绘制文字标识
painter.setFont(font);
painter.setPen(Qt::white);
painter.drawText(rect, Qt::AlignCenter, text);
}
bool DeviceButton::eventFilter(QObject *watched, QEvent *event)
{
//识别鼠标 按下+移动+松开+双击 等事件
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (event->type() == QEvent::MouseButtonPress) {
//限定鼠标左键
if (mouseEvent->button() == Qt::LeftButton) {
lastPoint = mouseEvent->pos();
isPressed = true;
Q_EMIT clicked();
return true;
}
} else if (event->type() == QEvent::MouseMove) {
//允许拖动并且鼠标按下准备拖动
if (canMove && isPressed) {
int dx = mouseEvent->pos().x() - lastPoint.x();
int dy = mouseEvent->pos().y() - lastPoint.y();
this->move(this->x() + dx, this->y() + dy);
return true;
}
} else if (event->type() == QEvent::MouseButtonRelease) {
isPressed = false;
} else if (event->type() == QEvent::MouseButtonDblClick) {
Q_EMIT doubleClicked();
}
return QWidget::eventFilter(watched, event);
}
QSize DeviceButton::sizeHint() const
{
return QSize(50, 50);
}
QSize DeviceButton::minimumSizeHint() const
{
return QSize(10, 10);
}
void DeviceButton::checkAlarm()
{
if (isDark) {
imgName = QString("%1_%2_%3.png").arg(imgPath).arg(colorNormal).arg(type);
} else {
imgName = QString("%1_%2_%3.png").arg(imgPath).arg(colorAlarm).arg(type);
}
isDark = !isDark;
this->update();
}
bool DeviceButton::getCanMove() const
{
return this->canMove;
}
void DeviceButton::setCanMove(bool canMove)
{
this->canMove = canMove;
}
QString DeviceButton::getText() const
{
return this->text;
}
void DeviceButton::setText(const QString &text)
{
if (this->text != text) {
this->text = text;
this->update();
}
}
QString DeviceButton::getColorNormal() const
{
return this->colorNormal;
}
void DeviceButton::setColorNormal(const QString &colorNormal)
{
if (this->colorNormal != colorNormal) {
this->colorNormal = colorNormal;
this->update();
}
}
QString DeviceButton::getColorAlarm() const
{
return this->colorAlarm;
}
void DeviceButton::setColorAlarm(const QString &colorAlarm)
{
if (this->colorAlarm != colorAlarm) {
this->colorAlarm = colorAlarm;
this->update();
}
}
DeviceButton::ButtonStyle DeviceButton::getButtonStyle() const
{
return this->buttonStyle;
}
void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle)
{
this->buttonStyle = buttonStyle;
if (buttonStyle == ButtonStyle_Circle) {
type = "circle";
} else if (buttonStyle == ButtonStyle_Police) {
type = "police";
} else if (buttonStyle == ButtonStyle_Bubble) {
type = "bubble";
} else if (buttonStyle == ButtonStyle_Bubble2) {
type = "bubble2";
} else if (buttonStyle == ButtonStyle_Msg) {
type = "msg";
} else if (buttonStyle == ButtonStyle_Msg2) {
type = "msg2";
} else {
type = "circle";
}
setButtonColor(buttonColor);
}
DeviceButton::ButtonColor DeviceButton::getButtonColor() const
{
return this->buttonColor;
}
void DeviceButton::setButtonColor(const DeviceButton::ButtonColor &buttonColor)
{
//先停止定时器
this->buttonColor = buttonColor;
isDark = false;
if (timer->isActive()) {
timer->stop();
}
QString color;
if (buttonColor == ButtonColor_Green) {
color = "green";
} else if (buttonColor == ButtonColor_Blue) {
color = "blue";
} else if (buttonColor == ButtonColor_Gray) {
color = "gray";
} else if (buttonColor == ButtonColor_Black) {
color = "black";
} else if (buttonColor == ButtonColor_Purple) {
color = "purple";
} else if (buttonColor == ButtonColor_Yellow) {
color = "yellow";
} else if (buttonColor == ButtonColor_Red) {
color = "red";
} else {
color = "green";
}
//如果和报警颜色一致则主动启动定时器切换报警颜色
imgName = QString("%1_%2_%3.png").arg(imgPath).arg(color).arg(type);
if (color == colorAlarm) {
checkAlarm();
if (!timer->isActive()) {
timer->start();
}
}
this->update();
}

@ -0,0 +1,123 @@
#ifndef DEVICEBUTTON_H
#define DEVICEBUTTON_H
/**
* :feiyangqingyun(QQ:517216493) 2018-07-02
* 1. 22
* 2.
* 3.
* 4.
* 5.
* 6.
*/
#include <QWidget>
#ifdef quc
class Q_DECL_EXPORT DeviceButton : public QWidget
#else
class DeviceButton : public QWidget
#endif
{
Q_OBJECT
Q_ENUMS(ButtonStyle)
Q_ENUMS(ButtonColor)
Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove)
Q_PROPERTY(QString text READ getText WRITE setText)
Q_PROPERTY(QString colorNormal READ getColorNormal WRITE setColorNormal)
Q_PROPERTY(QString colorAlarm READ getColorAlarm WRITE setColorAlarm)
Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle)
Q_PROPERTY(ButtonColor buttonColor READ getButtonColor WRITE setButtonColor)
public:
//设备按钮样式
enum ButtonStyle {
ButtonStyle_Circle = 0, //圆形
ButtonStyle_Police = 1, //警察
ButtonStyle_Bubble = 2, //气泡
ButtonStyle_Bubble2 = 3, //气泡2
ButtonStyle_Msg = 4, //消息
ButtonStyle_Msg2 = 5 //消息2
};
//设备按钮颜色
enum ButtonColor {
ButtonColor_Green = 0, //绿色(激活状态)
ButtonColor_Blue = 1, //蓝色(在线状态)
ButtonColor_Red = 2, //红色(报警状态)
ButtonColor_Gray = 3, //灰色(离线状态)
ButtonColor_Black = 4, //黑色(故障状态)
ButtonColor_Purple = 5, //紫色(其他状态)
ButtonColor_Yellow = 6 //黄色(其他状态)
};
explicit DeviceButton(QWidget *parent = 0);
~DeviceButton();
protected:
void paintEvent(QPaintEvent *);
bool eventFilter(QObject *watched, QEvent *event);
private:
bool canMove; //是否可移动
QString text; //显示文字
QString colorNormal; //正常颜色
QString colorAlarm; //报警颜色
ButtonStyle buttonStyle;//按钮样式
ButtonColor buttonColor;//按钮颜色
bool isPressed; //鼠标是否按下
QPoint lastPoint; //鼠标按下最后坐标
QString type; //图片末尾类型
QString imgPath; //背景图片路径
QString imgName; //背景图片名称
bool isDark; //是否加深报警
QTimer *timer; //报警闪烁定时器
private slots:
void checkAlarm(); //切换报警状态
public:
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
//获取和设置可移动
bool getCanMove() const;
void setCanMove(bool canMove);
//获取和设置显示文字
QString getText() const;
void setText(const QString &text);
//获取和设置正常颜色
QString getColorNormal() const;
void setColorNormal(const QString &colorNormal);
//获取和设置报警颜色
QString getColorAlarm() const;
void setColorAlarm(const QString &colorAlarm);
//获取和设置样式
ButtonStyle getButtonStyle() const;
void setButtonStyle(const ButtonStyle &buttonStyle);
//获取和设置颜色
ButtonColor getButtonColor() const;
void setButtonColor(const ButtonColor &buttonColor);
Q_SIGNALS:
//鼠标单击双击事件
void clicked();
void doubleClicked();
};
#endif //DEVICEBUTTON_H

@ -0,0 +1,19 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = devicebutton
TEMPLATE = app
DESTDIR = $$PWD/../bin
CONFIG += warn_off
SOURCES += main.cpp
SOURCES += frmdevicebutton.cpp
SOURCES += devicebutton.cpp
HEADERS += frmdevicebutton.h
HEADERS += devicebutton.h
FORMS += frmdevicebutton.ui
RESOURCES += main.qrc

@ -0,0 +1,71 @@
#include "frmdevicebutton.h"
#include "ui_frmdevicebutton.h"
#include "devicebutton.h"
#include "qdebug.h"
frmDeviceButton::frmDeviceButton(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceButton)
{
ui->setupUi(this);
this->initForm();
}
frmDeviceButton::~frmDeviceButton()
{
delete ui;
}
void frmDeviceButton::initForm()
{
//设置背景地图
ui->labMap->setStyleSheet("border-image:url(:/image/bg_call.jpg);");
btn1 = new DeviceButton(ui->labMap);
btn1->setText("#1");
btn1->setGeometry(5, 5, 35, 35);
btn2 = new DeviceButton(ui->labMap);
btn2->setText("#2");
btn2->setGeometry(45, 5, 35, 35);
btn3 = new DeviceButton(ui->labMap);
btn3->setText("#3");
btn3->setGeometry(85, 5, 35, 35);
btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2;
foreach (QPushButton *btn, btnStyle) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle()));
}
btnColor << ui->btnGreen << ui->btnBlue << ui->btnRed << ui->btnGray << ui->btnBlack << ui->btnPurple << ui->btnYellow;
foreach (QPushButton *btn, btnColor) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeColor()));
}
}
void frmDeviceButton::changeStyle()
{
QPushButton *btn = (QPushButton *)sender();
int index = btnStyle.indexOf(btn);
DeviceButton::ButtonStyle style = (DeviceButton::ButtonStyle)index;
btn1->setButtonStyle(style);
btn2->setButtonStyle(style);
btn3->setButtonStyle(style);
}
void frmDeviceButton::changeColor()
{
QPushButton *btn = (QPushButton *)sender();
int index = btnColor.indexOf(btn);
DeviceButton::ButtonColor style = (DeviceButton::ButtonColor)index;
btn1->setButtonColor(style);
btn2->setButtonColor(style);
btn3->setButtonColor(style);
}
void frmDeviceButton::on_ckCanMove_stateChanged(int arg1)
{
bool canMove = (arg1 != 0);
btn1->setCanMove(canMove);
btn2->setCanMove(canMove);
btn3->setCanMove(canMove);
}

@ -0,0 +1,36 @@
#ifndef FRMDEVICEBUTTON_H
#define FRMDEVICEBUTTON_H
#include <QWidget>
class DeviceButton;
class QPushButton;
namespace Ui {
class frmDeviceButton;
}
class frmDeviceButton : public QWidget
{
Q_OBJECT
public:
explicit frmDeviceButton(QWidget *parent = 0);
~frmDeviceButton();
private slots:
void initForm();
void changeStyle();
void changeColor();
void on_ckCanMove_stateChanged(int arg1);
private:
Ui::frmDeviceButton *ui;
DeviceButton *btn1;
DeviceButton *btn2;
DeviceButton *btn3;
QList<QPushButton *> btnStyle;
QList<QPushButton *> btnColor;
};
#endif // FRMDEVICEBUTTON_H

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frmDeviceButton</class>
<widget class="QWidget" name="frmDeviceButton">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>900</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labMap">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="btnCircle">
<property name="text">
<string>圆形</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPolice">
<property name="text">
<string>警察</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBubble">
<property name="text">
<string>气泡</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBubble2">
<property name="text">
<string>气泡2</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMsg">
<property name="text">
<string>消息</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMsg2">
<property name="text">
<string>消息2</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnGreen">
<property name="text">
<string>绿色</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBlue">
<property name="text">
<string>蓝色</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRed">
<property name="text">
<string>红色</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnGray">
<property name="text">
<string>灰色</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBlack">
<property name="text">
<string>黑色</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPurple">
<property name="text">
<string>紫色</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnYellow">
<property name="text">
<string>黄色</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ckCanMove">
<property name="text">
<string>可移动</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save