更新代码

master
feiyangqingyun 2021-11-14 13:06:47 +08:00
parent 9db5b9f277
commit 8511dc866c
12 changed files with 126 additions and 43 deletions

View File

@ -144,22 +144,22 @@ void ColorWidget::showColorValue()
int red, green, blue;
QString strDecimalValue, strHex;
if (!pixmap.isNull()) {
QImage image = pixmap.toImage();
if (!image.isNull()) {
if (image.valid(0, 0)) {
QColor color = image.pixel(0, 0);
red = color.red();
green = color.green();
blue = color.blue();
QString strRed = tr("%1").arg(red & 0xFF, 2, 16, QChar('0'));
QString strGreen = tr("%1").arg(green & 0xFF, 2, 16, QChar('0'));
QString strBlue = tr("%1").arg(blue & 0xFF, 2, 16, QChar('0'));
if (pixmap.isNull()) {
return;
}
strDecimalValue = tr("%1, %2, %3").arg(red).arg(green).arg(blue);
strHex = tr("#%1%2%3").arg(strRed.toUpper()).arg(strGreen.toUpper()).arg(strBlue.toUpper());
}
}
QImage image = pixmap.toImage();
if (image.valid(0, 0)) {
QColor color = image.pixel(0, 0);
red = color.red();
green = color.green();
blue = color.blue();
QString strRed = tr("%1").arg(red & 0xFF, 2, 16, QChar('0'));
QString strGreen = tr("%1").arg(green & 0xFF, 2, 16, QChar('0'));
QString strBlue = tr("%1").arg(blue & 0xFF, 2, 16, QChar('0'));
strDecimalValue = tr("%1, %2, %3").arg(red).arg(green).arg(blue);
strHex = tr("#%1%2%3").arg(strRed.toUpper()).arg(strGreen.toUpper()).arg(strBlue.toUpper());
}
//根据背景色自动计算合适的前景色

View File

@ -1,6 +1,15 @@
#ifndef COLORWIDGET_H
#define COLORWIDGET_H
/**
* :feiyangqingyun(QQ:517216493) 2016-11-11
* 1.
* 2.
* 3. 16rgb
* 4.
* 5.
*/
#include <QWidget>
class QGridLayout;

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -51,11 +51,11 @@ public:
//设置进度条样式
static QString setProgressQss(QProgressBar *bar,
int barHeight = 8, //进度条高度
int barRadius = 5, //进度条半径
int fontSize = 9, //文字字号
const QString &normalColor = "#E8EDF2", //正常颜色
const QString &chunkColor = "#E74C3C"); //进度颜色
int barHeight = 8, //进度条高度
int barRadius = 5, //进度条半径
int fontSize = 9, //文字字号
const QString &normalColor = "#E8EDF2", //正常颜色
const QString &chunkColor = "#E74C3C"); //进度颜色
//设置滑块条样式
static QString setSliderQss(QSlider *slider, //滑动条对象

View File

@ -1,6 +1,24 @@
#ifndef FRAMELESSDIALOG_H
#define FRAMELESSDIALOG_H
/**
* :feiyangqingyun(QQ:517216493) 2021-07-27
* 1. Qt4-Qt6Qt4.7Qt6.2
* 2. mingwmsvcgcc
* 3. windowslinuxmac
* 4. QMainWindowQWidgetQDialog
* 5. 使
* 6.
* 7. windows
* 8. windows
* 9. macBUG
* 10. BUG
* 11. BUG
* 12. 1300
* 13.
* 14. Qt
*/
#include <QDialog>
#ifdef quc

View File

@ -1,6 +1,24 @@
#ifndef FRAMELESSMAINWINDOW_H
#define FRAMELESSMAINWINDOW_H
/**
* :feiyangqingyun(QQ:517216493) 2021-07-27
* 1. Qt4-Qt6Qt4.7Qt6.2
* 2. mingwmsvcgcc
* 3. windowslinuxmac
* 4. QMainWindowQWidgetQDialog
* 5. 使
* 6.
* 7. windows
* 8. windows
* 9. macBUG
* 10. BUG
* 11. BUG
* 12. 1300
* 13.
* 14. Qt
*/
#include <QMainWindow>
#ifdef quc

View File

@ -1,6 +1,24 @@
#ifndef FRAMELESSWIDGET_H
#define FRAMELESSWIDGET_H
/**
* :feiyangqingyun(QQ:517216493) 2021-07-27
* 1. Qt4-Qt6Qt4.7Qt6.2
* 2. mingwmsvcgcc
* 3. windowslinuxmac
* 4. QMainWindowQWidgetQDialog
* 5. 使
* 6.
* 7. windows
* 8. windows
* 9. macBUG
* 10. BUG
* 11. BUG
* 12. 1300
* 13.
* 14. Qt
*/
#include <QWidget>
#ifdef quc

View File

@ -30,13 +30,21 @@ protected:
private:
static QScopedPointer<MaskWidget> self;
QWidget *mainWidget; //需要遮罩的主窗体
QStringList dialogNames; //可能弹窗的窗体对象名称集合链表
//需要遮罩的主窗体
QWidget *mainWidget;
//需要弹窗的窗体对象名称集合链表
QStringList dialogNames;
public Q_SLOTS:
//设置需要遮罩的主窗体
void setMainWidget(QWidget *mainWidget);
//设置需要弹窗的窗体对象名称集合链表
void setDialogNames(const QStringList &dialogNames);
//设置遮罩颜色
void setBgColor(const QColor &bgColor);
//设置颜色透明度
void setOpacity(double opacity);
};

View File

@ -4,7 +4,9 @@
/**
* Ntp :feiyangqingyun(QQ:517216493) 2017-02-16
* 1. NtpIP
* 2.
* 2. ntp1.aliyun.com
* 3.
* 4.
*/
#include <QObject>
@ -33,15 +35,15 @@ private slots:
void sendData();
void setTime_t(uint secsSince1Jan1970UTC);
signals:
//收到时间返回
void receiveTime(const QDateTime &dateTime);
public slots:
//设置NTP服务器IP
public Q_SLOTS:
//设置Ntp服务器IP
void setNtpIP(const QString &ntpIP);
//获取日期时间
void getDateTime();
Q_SIGNALS:
//收到时间返回
void receiveTime(const QDateTime &dateTime);
};
#endif // NTPCLIENT_H

View File

@ -34,7 +34,7 @@ void Log(QtMsgType type, const char *msg)
content = QString("Debug %1").arg(msg);
}
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
#if (QT_VERSION >= QT_VERSION_CHECK(5,5,0))
case QtInfoMsg:
if ((msgType & MsgType_Info) == MsgType_Info) {
content = QString("Infox %1").arg(msg);

View File

@ -3,9 +3,11 @@
/**
* :feiyangqingyun(QQ:517216493) 2016-11-11
* 1.
* 2.
* 3.
* 1.
* 2.
* 3.
* 4.
* 5.
*/
#include <QWidget>
@ -33,16 +35,24 @@ public:
int width();
int height();
bool isInArea(QPoint pos); // 检测pos是否在截图区域内
void move(QPoint p); // 按 p 移动截图区域
//检测坐标点是否在截图区域内
bool isInArea(QPoint pos);
//按坐标移动截图区域
void move(QPoint p);
private:
QPoint leftUpPos, rightDownPos; //记录 截图区域 左上角、右下角
QPoint startPos, endPos; //记录 鼠标开始位置、结束位置
int maxWidth, maxHeight; //记录屏幕大小
STATUS status; //三个状态: 选择区域、移动区域、设置width height
//记录 截图区域 左上角、右下角
QPoint leftUpPos, rightDownPos;
//记录 鼠标开始位置、结束位置
QPoint startPos, endPos;
//记录屏幕大小
int maxWidth, maxHeight;
//三个状态: 选择区域、移动区域、设置width height
STATUS status;
void cmpPoint(QPoint &s, QPoint &e);//比较两位置,判断左上角、右下角
//比较两位置,判断左上角、右下角
void cmpPoint(QPoint &s, QPoint &e);
};
#ifdef quc