mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
Merge branch 'dev-fact'
This commit is contained in:
commit
83b9b3efd3
@ -61,7 +61,8 @@ SUBDIRS =
|
|||||||
#some test project
|
#some test project
|
||||||
#SUBDIRS += test/gumbo_query_test
|
#SUBDIRS += test/gumbo_query_test
|
||||||
#SUBDIRS += test/customqvariant
|
#SUBDIRS += test/customqvariant
|
||||||
#SUBDIRS += test/framelesshelperwidget
|
#
|
||||||
|
SUBDIRS += test/framelesshelperwidget
|
||||||
#SUBDIRS += test/treeviewtest
|
#SUBDIRS += test/treeviewtest
|
||||||
#SUBDIRS += test/bytearraytest
|
#SUBDIRS += test/bytearraytest
|
||||||
#!contains(QKIT_PRIVATE, iOS|iOSSimulator){
|
#!contains(QKIT_PRIVATE, iOS|iOSSimulator){
|
||||||
@ -78,15 +79,17 @@ SUBDIRS =
|
|||||||
##need bluetooth library
|
##need bluetooth library
|
||||||
#greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += test/qqtbtfileserver
|
#greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += test/qqtbtfileserver
|
||||||
|
|
||||||
|
#0000
|
||||||
#SUBDIRS += test/svgtest
|
#SUBDIRS += test/svgtest
|
||||||
#SUBDIRS += test/qqtdicttest
|
#SUBDIRS += test/qqtdicttest
|
||||||
#必开
|
#必开
|
||||||
SUBDIRS += test/qqtdicttest2
|
#SUBDIRS += test/qqtdicttest2
|
||||||
#必开
|
#必开
|
||||||
SUBDIRS += test/giftest
|
#SUBDIRS += test/giftest
|
||||||
|
|
||||||
#必开 这两个例子是关于QQtAudio的最好展示
|
#必开 这两个例子是关于QQtAudio的最好展示
|
||||||
SUBDIRS += examples/qqtaudioexample
|
#SUBDIRS += examples/qqtaudioexample
|
||||||
|
#111111
|
||||||
#greaterThan(QT_VERSION, 4.6.0):SUBDIRS += test/voicetest
|
#greaterThan(QT_VERSION, 4.6.0):SUBDIRS += test/voicetest
|
||||||
#mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest
|
#mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest
|
||||||
|
|
||||||
@ -103,4 +106,10 @@ SUBDIRS += examples/qqtaudioexample
|
|||||||
#SUBDIRS += examples/qqtudpexample
|
#SUBDIRS += examples/qqtudpexample
|
||||||
#lessThan(QT_VERSION , 5.8.0):SUBDIRS -= examples/qqtudpexample
|
#lessThan(QT_VERSION , 5.8.0):SUBDIRS -= examples/qqtudpexample
|
||||||
|
|
||||||
SUBDIRS += test/openglwidgettest
|
#SUBDIRS += test/openglwidgettest
|
||||||
|
#SUBDIRS += test/osdtest
|
||||||
|
#SUBDIRS += test/inputtest
|
||||||
|
#SUBDIRS += demo/SysInfoNotify
|
||||||
|
SUBDIRS += demo/TouchMonitor
|
||||||
|
SUBDIRS += demo/TouchMonitorServer
|
||||||
|
|
||||||
|
19
README.md
19
README.md
@ -63,7 +63,7 @@ github link: https://github.com/AbelTian/LibQQt
|
|||||||
- 协议虚类(接口类) [QQtProtocol](src/network/qqtprotocol.h) QQtWebSocketProtocol
|
- 协议虚类(接口类) [QQtProtocol](src/network/qqtprotocol.h) QQtWebSocketProtocol
|
||||||
- 报文虚类(接口类) [QQtMessage](src/network/qqtmessage.h)
|
- 报文虚类(接口类) [QQtMessage](src/network/qqtmessage.h)
|
||||||
7. 添加应用中常用的form
|
7. 添加应用中常用的form
|
||||||
8. 支持多页表格 [QQtMPTableWidget](src/widgets/qqtmptablewidget.h)
|
8. 支持多页表格 [QQtMultiPageTableWidget](src/widgets/qqtmultipagetablewidget.h)
|
||||||
9. 添加 [QQtApplication](src/frame/qqtapplication.h),支持入门级、通用级、专用级嵌入式App所必须的初始化内容
|
9. 添加 [QQtApplication](src/frame/qqtapplication.h),支持入门级、通用级、专用级嵌入式App所必须的初始化内容
|
||||||
5. 支持Qt5.9.2
|
5. 支持Qt5.9.2
|
||||||
0. 跨平台支持macOS、iOS、Android、Windows、Linux、MIPS、ARM等。
|
0. 跨平台支持macOS、iOS、Android、Windows、Linux、MIPS、ARM等。
|
||||||
@ -91,6 +91,15 @@ github link: https://github.com/AbelTian/LibQQt
|
|||||||
- 支持webservice (QtSoap)
|
- 支持webservice (QtSoap)
|
||||||
|
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
# 多链接发布技术
|
||||||
|
|
||||||
|
LibQQt为方便用户开发App过程方便的发布程序,所以添加了多链接和自动发布功能,基于qmake工程管理器的多链接发布技术。
|
||||||
|
用户只需要做相应的目录设定,甚至包括自己的配置文件的目录设置,LibQQt提供的base manager就会自动将用户的程序,配置发布到指定位置,
|
||||||
|
并且支持其他依赖的链接库。
|
||||||
|
经过发布的App直接点击就可以运行,*大的省去了用户手动发布App的劳烦过程。
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
# 使用案例
|
# 使用案例
|
||||||
|
|
||||||
@ -105,8 +114,6 @@ github link: https://github.com/AbelTian/LibQQt
|
|||||||
*把LibQQt/extra/md5.exe 复制到C:\Windows*
|
*把LibQQt/extra/md5.exe 复制到C:\Windows*
|
||||||
|
|
||||||
[走,去看看入门用法](usage.md)
|
[走,去看看入门用法](usage.md)
|
||||||
[去看看Qt入门基础须知](usage-Qt.md)
|
|
||||||
[去看看Qt Creator入门安装须知](usage-QtCreator.md)
|
|
||||||
[入门了,去看看学习设置工程目录](project.md)
|
[入门了,去看看学习设置工程目录](project.md)
|
||||||
发现了一个问题: [new issue link](https://gitee.com/drabel/LibQQt/issues/new?issue%5Bassignee_id%5D=0&issue%5Bmilestone_id%5D=0)
|
发现了一个问题: [new issue link](https://gitee.com/drabel/LibQQt/issues/new?issue%5Bassignee_id%5D=0&issue%5Bmilestone_id%5D=0)
|
||||||
|
|
||||||
@ -116,14 +123,16 @@ github link: https://github.com/AbelTian/LibQQt
|
|||||||
|
|
||||||
[预习Git入门](usage-git.md)
|
[预习Git入门](usage-git.md)
|
||||||
[去看看软件基础概念](software.md)
|
[去看看软件基础概念](software.md)
|
||||||
|
[去看看Qt入门基础须知](usage-Qt.md)
|
||||||
|
[去看看Qt Creator入门安装须知](usage-QtCreator.md)
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
# LibQQt百科
|
# LibQQt百科
|
||||||
|
|
||||||
[跳转到LibQQt的百科知识页面](wiki/wiki.md "Wiki Page")
|
[跳转到LibQQt的百科知识页面](wiki/wiki.md "Wiki Page")
|
||||||
[阅读, 读我的LibQQt博客进行一系列的学习](http://blog.csdn.net/Dr_Abel)
|
[阅读我的LibQQt博客进行一系列的学习](http://blog.csdn.net/Dr_Abel)
|
||||||
[我来讲,LibQQt视频图说](http://www.soku.com/search_video/q_LibQQt?f=1&kb=04112010yv41000__)
|
[LibQQt视频图说](http://v.youku.com/v_show/id_XMzUzODQ4MTczMg==.html?spm=a2hzp.8244740.0.0)
|
||||||
[学会了使用?那么认识LibQQt吧](doc/knowledge-about-libQQt.md)
|
[学会了使用?那么认识LibQQt吧](doc/knowledge-about-libQQt.md)
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,10 +7,11 @@ LibQQt使用权不免费,一份使用权25万。
|
|||||||
- 购买一份使用权
|
- 购买一份使用权
|
||||||
- 一次付款25万,支付LibQQt的开发费用。
|
- 一次付款25万,支付LibQQt的开发费用。
|
||||||
- 银行转账,清澈透明。
|
- 银行转账,清澈透明。
|
||||||
- 支付赞助费
|
- 支付赞助金
|
||||||
- LibQQt为用户App提供Application Framework层功能支柱赞助,用户支付赞助金。
|
- LibQQt为用户App提供Application Framework层功能支柱赞助,用户支付赞助金。
|
||||||
- 0.01-0.1元 0.1-1元 1-100元 100-10000元 10000-1000000元 ...
|
- 0.01-0.1元 0.1-1元 1-100元 100-10000元 10000-1000000元 ...
|
||||||
- 扫码付款,实在便捷。
|
- 扫码付款,实在便捷。
|
||||||
|
- *这个方式还有要求用户为LibQQt进行宣传。*
|
||||||
|
|
||||||
|
|
||||||
## 银行账号
|
## 银行账号
|
||||||
|
45
demo/SysInfoNotify/SysInfoNotify.pro
Normal file
45
demo/SysInfoNotify/SysInfoNotify.pro
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2018-05-04T20:50:54
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = SysInfoNotify
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
mainwindow.ui
|
||||||
|
|
||||||
|
system("touch main.cpp")
|
||||||
|
#CONFIG += deploy_config
|
||||||
|
contains(CONFIG, deploy_config) {
|
||||||
|
APP_CONFIG_PWD = $${PWD}/AppRoot
|
||||||
|
equals(QMAKE_HOST.os, Windows) {
|
||||||
|
APP_CONFIG_PWD ~=s,/,\\,g
|
||||||
|
}
|
||||||
|
}
|
||||||
|
include(../../src/app_base_manager.pri)
|
||||||
|
include(app_version.pri)
|
14
demo/SysInfoNotify/app_version.pri
Normal file
14
demo/SysInfoNotify/app_version.pri
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#################################################################
|
||||||
|
##project $${TARGET} version pri
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
APP_MAJOR_VERSION = 0
|
||||||
|
APP_MINOR_VERSION = 1
|
||||||
|
APP_PATCH_VERSION = 0
|
||||||
|
APP_BUILD_VERSION = 0
|
||||||
|
|
||||||
|
APP_VERSION = $${APP_MAJOR_VERSION}.$${APP_MINOR_VERSION}.$${APP_PATCH_VERSION}
|
||||||
|
APP_VERSION4 = $${APP_MAJOR_VERSION}.$${APP_MINOR_VERSION}.$${APP_PATCH_VERSION}.$${APP_BUILD_VERSION}
|
||||||
|
DEFINES += APP_VERSION=$${APP_VERSION}
|
||||||
|
message (Build $${TARGET} version: $$APP_VERSION4)
|
||||||
|
unix:VERSION = $${APP_VERSION}
|
12
demo/SysInfoNotify/main.cpp
Normal file
12
demo/SysInfoNotify/main.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QQtApplication>
|
||||||
|
|
||||||
|
int main ( int argc, char* argv[] )
|
||||||
|
{
|
||||||
|
QQtApplication a ( argc, argv );
|
||||||
|
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
31
demo/SysInfoNotify/mainwindow.cpp
Normal file
31
demo/SysInfoNotify/mainwindow.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include "qqtsysteminfo.h"
|
||||||
|
|
||||||
|
MainWindow::MainWindow ( QWidget* parent ) :
|
||||||
|
QMainWindow ( parent ),
|
||||||
|
ui ( new Ui::MainWindow )
|
||||||
|
{
|
||||||
|
ui->setupUi ( this );
|
||||||
|
|
||||||
|
TCPUTable cpu;
|
||||||
|
QQtSystemInfo s;
|
||||||
|
s.getCPUInfo ( cpu );
|
||||||
|
s.getCPUInfo ( cpu );
|
||||||
|
pline() << cpu.mNum;
|
||||||
|
QListIterator<TCPUInfo> itor ( cpu.mList );
|
||||||
|
while ( itor.hasNext() )
|
||||||
|
{
|
||||||
|
const TCPUInfo& c = itor.next();
|
||||||
|
pline() << c.mCoreNum;
|
||||||
|
}
|
||||||
|
TMemTable mem;
|
||||||
|
s.getMEMInfo ( mem );
|
||||||
|
pline() << mem.mNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
22
demo/SysInfoNotify/mainwindow.h
Normal file
22
demo/SysInfoNotify/mainwindow.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
24
demo/SysInfoNotify/mainwindow.ui
Normal file
24
demo/SysInfoNotify/mainwindow.ui
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenuBar" name="menuBar" />
|
||||||
|
<widget class="QToolBar" name="mainToolBar" />
|
||||||
|
<widget class="QWidget" name="centralWidget" />
|
||||||
|
<widget class="QStatusBar" name="statusBar" />
|
||||||
|
</widget>
|
||||||
|
<layoutDefault spacing="6" margin="11" />
|
||||||
|
<pixmapfunction></pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
44
demo/TouchMonitor/TouchMonitor.pro
Normal file
44
demo/TouchMonitor/TouchMonitor.pro
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2018-05-06T15:03:12
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = TouchMonitor
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
mainwindow.ui
|
||||||
|
|
||||||
|
system("touch main.cpp")
|
||||||
|
#CONFIG += deploy_config
|
||||||
|
contains(CONFIG, deploy_config) {
|
||||||
|
APP_CONFIG_PWD = $${PWD}/AppRoot
|
||||||
|
equals(QMAKE_HOST.os, Windows) {
|
||||||
|
APP_CONFIG_PWD ~=s,/,\\,g
|
||||||
|
}
|
||||||
|
}
|
||||||
|
include(../../src/app_base_manager.pri)
|
11
demo/TouchMonitor/main.cpp
Normal file
11
demo/TouchMonitor/main.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
14
demo/TouchMonitor/mainwindow.cpp
Normal file
14
demo/TouchMonitor/mainwindow.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
MainWindow::MainWindow ( QWidget* parent ) :
|
||||||
|
QMainWindow ( parent ),
|
||||||
|
ui ( new Ui::MainWindow )
|
||||||
|
{
|
||||||
|
ui->setupUi ( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
22
demo/TouchMonitor/mainwindow.h
Normal file
22
demo/TouchMonitor/mainwindow.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
24
demo/TouchMonitor/mainwindow.ui
Normal file
24
demo/TouchMonitor/mainwindow.ui
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenuBar" name="menuBar" />
|
||||||
|
<widget class="QToolBar" name="mainToolBar" />
|
||||||
|
<widget class="QWidget" name="centralWidget" />
|
||||||
|
<widget class="QStatusBar" name="statusBar" />
|
||||||
|
</widget>
|
||||||
|
<layoutDefault spacing="6" margin="11" />
|
||||||
|
<pixmapfunction></pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
49
demo/TouchMonitorServer/TouchMonitorServer.pro
Normal file
49
demo/TouchMonitorServer/TouchMonitorServer.pro
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2018-05-06T15:03:12
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = TouchMonitorServer
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp \
|
||||||
|
testwidget.cpp \
|
||||||
|
qqtosdform.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h \
|
||||||
|
testwidget.h \
|
||||||
|
qqtosdform.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
mainwindow.ui \
|
||||||
|
qqtosdform.ui
|
||||||
|
|
||||||
|
system("touch main.cpp")
|
||||||
|
#CONFIG += deploy_config
|
||||||
|
contains(CONFIG, deploy_config) {
|
||||||
|
APP_CONFIG_PWD = $${PWD}/AppRoot
|
||||||
|
equals(QMAKE_HOST.os, Windows) {
|
||||||
|
APP_CONFIG_PWD ~=s,/,\\,g
|
||||||
|
}
|
||||||
|
}
|
||||||
|
include(../../src/app_base_manager.pri)
|
27
demo/TouchMonitorServer/main.cpp
Normal file
27
demo/TouchMonitorServer/main.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QQtApplication>
|
||||||
|
#include <qqtosdwidget.h>
|
||||||
|
#include <testwidget.h>
|
||||||
|
#include <qqtosdform.h>
|
||||||
|
|
||||||
|
int main ( int argc, char* argv[] )
|
||||||
|
{
|
||||||
|
QQtApplication a ( argc, argv );
|
||||||
|
|
||||||
|
//其实功能很简单,
|
||||||
|
//收到手机通过网络、或者蓝牙、或者USB线发来的操作信号以后,服务器进行POS转换,模拟点击。
|
||||||
|
//起初,用于手机控制腾讯手游助手里的王者荣耀游戏。
|
||||||
|
|
||||||
|
MainWindow w;
|
||||||
|
//TestWidget w;
|
||||||
|
//macOS success
|
||||||
|
//QQtOsdForm w;
|
||||||
|
//macOS success
|
||||||
|
//QQtOSDWidget w;
|
||||||
|
w.show();
|
||||||
|
//w.setWindowOpacity ( 1 );
|
||||||
|
//w.setWindowFlags ( Qt::FramelessWindowHint );
|
||||||
|
//w.setAttribute ( Qt::WA_TranslucentBackground );
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
22
demo/TouchMonitorServer/mainwindow.cpp
Normal file
22
demo/TouchMonitorServer/mainwindow.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <qqtosdwidget.h>
|
||||||
|
|
||||||
|
MainWindow::MainWindow ( QWidget* parent ) :
|
||||||
|
QMainWindow ( parent ),
|
||||||
|
ui ( new Ui::MainWindow )
|
||||||
|
{
|
||||||
|
ui->setupUi ( this );
|
||||||
|
|
||||||
|
QQtOSDWidget* w = new QQtOSDWidget ( 0 );
|
||||||
|
w->show();
|
||||||
|
w->setGeometry ( 0, 0, 400, 400 );
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
23
demo/TouchMonitorServer/mainwindow.h
Normal file
23
demo/TouchMonitorServer/mainwindow.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow ( QWidget* parent = 0 );
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow* ui;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
24
demo/TouchMonitorServer/mainwindow.ui
Normal file
24
demo/TouchMonitorServer/mainwindow.ui
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenuBar" name="menuBar" />
|
||||||
|
<widget class="QToolBar" name="mainToolBar" />
|
||||||
|
<widget class="QWidget" name="centralWidget" />
|
||||||
|
<widget class="QStatusBar" name="statusBar" />
|
||||||
|
</widget>
|
||||||
|
<layoutDefault spacing="6" margin="11" />
|
||||||
|
<pixmapfunction></pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
57
demo/TouchMonitorServer/qqtosdform.cpp
Normal file
57
demo/TouchMonitorServer/qqtosdform.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#include "qqtosdform.h"
|
||||||
|
#include "ui_qqtosdform.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QBitmap>
|
||||||
|
#include <qqtframelesshelper.h>
|
||||||
|
|
||||||
|
QQtOsdForm::QQtOsdForm ( QWidget* parent ) :
|
||||||
|
QWidget ( parent ),
|
||||||
|
ui ( new Ui::QQtOsdForm )
|
||||||
|
{
|
||||||
|
ui->setupUi ( this );
|
||||||
|
//setStyleSheet ( "QQtOsdForm{ background-color: rgb(222, 222, 222, 0);}" );
|
||||||
|
//setWindowFlag ( Qt::FramelessWindowHint, true );
|
||||||
|
//setWindowFlag ( Qt::WindowStaysOnTopHint, true );
|
||||||
|
//setWindowFlag ( Qt::Tool, true );
|
||||||
|
setAttribute ( Qt::WA_TranslucentBackground, true );
|
||||||
|
//setAttribute ( Qt::WA_TransparentForMouseEvents, true );
|
||||||
|
setAttribute ( Qt::WA_OpaquePaintEvent, true );
|
||||||
|
|
||||||
|
QPalette pal = palette();
|
||||||
|
pal.setColor ( QPalette::Background, QColor ( 255, 255, 255, 255 ) );
|
||||||
|
//ignore
|
||||||
|
//setPalette ( pal );
|
||||||
|
|
||||||
|
QQtFramelessHelper* frameless = new QQtFramelessHelper ( this );
|
||||||
|
frameless->addDragWidget ( this );
|
||||||
|
frameless->setCloseButton ( ui->pushButtonClose );
|
||||||
|
frameless->setMaximizedButton ( ui->pushButtonMax );
|
||||||
|
frameless->setRestoreButton ( ui->pushButtonRestore );
|
||||||
|
frameless->setMinimizedButton ( ui->pushButtonMin, false );
|
||||||
|
|
||||||
|
//setWindowFlag ( Qt::FramelessWindowHint, true );
|
||||||
|
//setWindowFlag ( Qt::CustomizeWindowHint, true );
|
||||||
|
//setWindowFlag ( Qt::SubWindow, true );
|
||||||
|
//setWindowFlag ( Qt::WindowSystemMenuHint, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
QQtOsdForm::~QQtOsdForm()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QQtOsdForm::paintEvent ( QPaintEvent* event )
|
||||||
|
{
|
||||||
|
return QWidget::paintEvent ( event );
|
||||||
|
|
||||||
|
//ignore
|
||||||
|
// Use a bitmap as a mask. A bitmap only has two kind of colors: white(value is 0)
|
||||||
|
// or black(other values). When we use it to set mask, we can see the window at the position
|
||||||
|
// where the color value is 0, and other place will be transparent.
|
||||||
|
QBitmap bitMap ( width(), height() ); // A bit map has the same size with current widget
|
||||||
|
QPainter painter ( &bitMap );
|
||||||
|
painter.setPen ( QColor ( 255, 255, 255 ) ); // Any color that is not QRgb(0,0,0) is right
|
||||||
|
painter.drawRect ( 0, 0, width(), height() );
|
||||||
|
setMask ( bitMap );
|
||||||
|
}
|
26
demo/TouchMonitorServer/qqtosdform.h
Normal file
26
demo/TouchMonitorServer/qqtosdform.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef QQTOSDFORM_H
|
||||||
|
#define QQTOSDFORM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class QQtOsdForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
class QQtOsdForm : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit QQtOsdForm ( QWidget* parent = 0 );
|
||||||
|
~QQtOsdForm();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::QQtOsdForm* ui;
|
||||||
|
|
||||||
|
// QWidget interface
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTOSDFORM_H
|
79
demo/TouchMonitorServer/qqtosdform.ui
Normal file
79
demo/TouchMonitorServer/qqtosdform.ui
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>QQtOsdForm</class>
|
||||||
|
<widget class="QWidget" name="QQtOsdForm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonMin">
|
||||||
|
<property name="text">
|
||||||
|
<string>最小化</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonMax">
|
||||||
|
<property name="text">
|
||||||
|
<string>最大化</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonRestore">
|
||||||
|
<property name="text">
|
||||||
|
<string>还原</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonClose">
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>259</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
39
demo/TouchMonitorServer/testwidget.cpp
Normal file
39
demo/TouchMonitorServer/testwidget.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "testwidget.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QBitmap>
|
||||||
|
|
||||||
|
TestWidget::TestWidget ( QWidget* parent ) : QWidget ( parent )
|
||||||
|
{
|
||||||
|
//setAttribute ( Qt::WA_TranslucentBackground, true );
|
||||||
|
//setAttribute ( Qt::WA_OpaquePaintEvent, true );
|
||||||
|
//QPalette pal = palette();
|
||||||
|
//pal.setColor ( QPalette::Background, QColor ( 255, 0, 0, 200 ) );
|
||||||
|
//setPalette ( pal );
|
||||||
|
//setStyleSheet ( "background:transparent" );
|
||||||
|
|
||||||
|
}
|
||||||
|
void TestWidget::paintEvent ( QPaintEvent* event )
|
||||||
|
{
|
||||||
|
|
||||||
|
//return QWidget::paintEvent ( event );
|
||||||
|
|
||||||
|
//QPainter painter ( this );
|
||||||
|
//painter.fillRect ( this->rect(), QColor ( 0, 0, 255, 80 ) );
|
||||||
|
|
||||||
|
//QPainter p ( this );
|
||||||
|
//p.setCompositionMode ( QPainter::CompositionMode_Clear );
|
||||||
|
//p.fillRect ( 10, 10, 300, 300, Qt::SolidPattern );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TestWidget::resizeEvent ( QResizeEvent* event )
|
||||||
|
{
|
||||||
|
// Use a bitmap as a mask. A bitmap only has two kind of colors: white(value is 0)
|
||||||
|
// or black(other values). When we use it to set mask, we can see the window at the position
|
||||||
|
// where the color value is 0, and other place will be transparent.
|
||||||
|
QBitmap bitMap ( width(), height() ); // A bit map has the same size with current widget
|
||||||
|
QPainter painter ( &bitMap );
|
||||||
|
painter.setPen ( QColor ( 0, 0, 0 ) ); // Any color that is not QRgb(0,0,0) is right
|
||||||
|
painter.drawRect ( 0, 0, width(), height() );
|
||||||
|
setMask ( bitMap );
|
||||||
|
}
|
25
demo/TouchMonitorServer/testwidget.h
Normal file
25
demo/TouchMonitorServer/testwidget.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef TESTWIDGET_H
|
||||||
|
#define TESTWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <qqtcore.h>
|
||||||
|
|
||||||
|
class TestWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit TestWidget ( QWidget* parent = nullptr );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
// QWidget interface
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
|
|
||||||
|
// QWidget interface
|
||||||
|
protected:
|
||||||
|
virtual void resizeEvent ( QResizeEvent* event ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TESTWIDGET_H
|
@ -23,119 +23,119 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
|
|
||||||
ui->w01->setRange(0, 100);
|
ui->w01->setRange(0, 100);
|
||||||
ui->w01->setBackgroundColor(QColor(60, 80, 100));
|
ui->w01->setBackgroundColor(QColor(60, 80, 100));
|
||||||
ui->w01->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc);
|
ui->w01->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc);
|
||||||
ui->w01->setShowFree(true);
|
ui->w01->setShowFree(true);
|
||||||
ui->w01->setShowSmallCircle(true);
|
ui->w01->setShowSmallCircle(true);
|
||||||
ui->w01->setTextStyle(QQtCustomEffectProgressBar::TextStyle_Text);
|
ui->w01->setTextStyle(QQtCustomProgressBar::TextStyle_Text);
|
||||||
ui->w01->setText("EE");
|
ui->w01->setText("EE");
|
||||||
ui->w01->setTextColor(QColor(128, 128, 66));
|
ui->w01->setTextColor(QColor(128, 128, 66));
|
||||||
ui->w01->setTextFont(QFont("Arial", 48));
|
ui->w01->setTextFont(QFont("Arial", 48));
|
||||||
|
|
||||||
ui->w0->setRange(0, 100);
|
ui->w0->setRange(0, 100);
|
||||||
ui->w0->setBackgroundColor(QColor(60, 80, 100));
|
ui->w0->setBackgroundColor(QColor(60, 80, 100));
|
||||||
ui->w0->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Polo);
|
ui->w0->setPercentStyle(QQtCustomProgressBar::PercentStyle_Polo);
|
||||||
ui->w0->setTextStyle(QQtCustomEffectProgressBar::TextStyle_Middle_Percent);
|
ui->w0->setTextStyle(QQtCustomProgressBar::TextStyle_Middle_Percent);
|
||||||
ui->w0->setPercentTextFont(QFont("Arial", 60));
|
ui->w0->setPercentTextFont(QFont("Arial", 60));
|
||||||
|
|
||||||
ui->w1->setBackgroundColor(QColor(60, 80, 100));
|
ui->w1->setBackgroundColor(QColor(60, 80, 100));
|
||||||
ui->w1->setRange(0, 100);
|
ui->w1->setRange(0, 100);
|
||||||
ui->w1->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc_Polo);
|
ui->w1->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc_Polo);
|
||||||
ui->w1->setTextStyle(QQtCustomEffectProgressBar::TextStyle_Percent_Text);
|
ui->w1->setTextStyle(QQtCustomProgressBar::TextStyle_Percent_Text);
|
||||||
ui->w1->setText("PP");
|
ui->w1->setText("PP");
|
||||||
ui->w1->setTextColor(QColor(128, 66, 66));
|
ui->w1->setTextColor(QColor(128, 66, 66));
|
||||||
ui->w1->setTextFont(QFont("Arial", 36));
|
ui->w1->setTextFont(QFont("Arial", 36));
|
||||||
ui->w1->setPercentSuffix("Day");
|
ui->w1->setPercentSuffix("Day");
|
||||||
|
|
||||||
ui->w2->setBackgroundColor(QColor(20, 40, 100));
|
ui->w2->setBackgroundColor(QColor(20, 40, 100));
|
||||||
ui->w2->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Wave);
|
ui->w2->setPercentStyle(QQtCustomProgressBar::PercentStyle_Wave);
|
||||||
ui->w2->setRange(0, 80);
|
ui->w2->setRange(0, 80);
|
||||||
ui->w2->setWaveDensity(2);
|
ui->w2->setWaveDensity(2);
|
||||||
ui->w2->setWaveDirection(QQtCustomEffectProgressBar::WaveDirection_Left_Right);
|
ui->w2->setWaveDirection(QQtCustomProgressBar::WaveDirection_Left_Right);
|
||||||
ui->w2->setWaveHeight(2);
|
ui->w2->setWaveHeight(2);
|
||||||
ui->w2->setWaveSpeed(6);
|
ui->w2->setWaveSpeed(6);
|
||||||
//ui->w2->setCircleType(QQtCustomEffectProgressBar::CircleType_Image);
|
//ui->w2->setCircleType(QQtCustomProgressBar::CircleType_Image);
|
||||||
//ui->w2->setCircleImage("./xxtest.png");
|
//ui->w2->setCircleImage("./xxtest.png");
|
||||||
|
|
||||||
ui->w5->setRange(0, 100);
|
ui->w5->setRange(0, 100);
|
||||||
ui->w5->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Ellipse);
|
ui->w5->setDesignStyle(QQtCustomProgressBar::DesignStyle_Ellipse);
|
||||||
ui->w5->setBackgroundColor(QColor(36, 80, 100));
|
ui->w5->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w5->setRange(0, 100);
|
ui->w5->setRange(0, 100);
|
||||||
ui->w5->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc);
|
ui->w5->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc);
|
||||||
|
|
||||||
ui->w6->setRange(0, 100);
|
ui->w6->setRange(0, 100);
|
||||||
ui->w6->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Ellipse);
|
ui->w6->setDesignStyle(QQtCustomProgressBar::DesignStyle_Ellipse);
|
||||||
ui->w6->setBackgroundColor(QColor(36, 80, 100));
|
ui->w6->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w6->setRange(0, 100);
|
ui->w6->setRange(0, 100);
|
||||||
ui->w6->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Polo);
|
ui->w6->setPercentStyle(QQtCustomProgressBar::PercentStyle_Polo);
|
||||||
|
|
||||||
ui->w3->setRange(0, 100);
|
ui->w3->setRange(0, 100);
|
||||||
ui->w3->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Ellipse);
|
ui->w3->setDesignStyle(QQtCustomProgressBar::DesignStyle_Ellipse);
|
||||||
ui->w3->setBackgroundColor(QColor(36, 80, 100));
|
ui->w3->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w3->setRange(0, 100);
|
ui->w3->setRange(0, 100);
|
||||||
ui->w3->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc_Polo);
|
ui->w3->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc_Polo);
|
||||||
|
|
||||||
ui->w4->setRange(0, 80);
|
ui->w4->setRange(0, 80);
|
||||||
ui->w4->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Ellipse);
|
ui->w4->setDesignStyle(QQtCustomProgressBar::DesignStyle_Ellipse);
|
||||||
ui->w4->setBackgroundColor(QColor(20, 40, 100));
|
ui->w4->setBackgroundColor(QColor(20, 40, 100));
|
||||||
ui->w4->setWaveDensity(2);
|
ui->w4->setWaveDensity(2);
|
||||||
ui->w4->setWaveDirection(QQtCustomEffectProgressBar::WaveDirection_Left_Right);
|
ui->w4->setWaveDirection(QQtCustomProgressBar::WaveDirection_Left_Right);
|
||||||
ui->w4->setWaveHeight(2);
|
ui->w4->setWaveHeight(2);
|
||||||
ui->w4->setWaveSpeed(6);
|
ui->w4->setWaveSpeed(6);
|
||||||
ui->w4->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Wave);
|
ui->w4->setPercentStyle(QQtCustomProgressBar::PercentStyle_Wave);
|
||||||
|
|
||||||
ui->w40->setRange(0, 100);
|
ui->w40->setRange(0, 100);
|
||||||
ui->w40->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Rectangle);
|
ui->w40->setDesignStyle(QQtCustomProgressBar::DesignStyle_Rectangle);
|
||||||
ui->w40->setBackgroundColor(QColor(36, 80, 100));
|
ui->w40->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w40->setRange(0, 100);
|
ui->w40->setRange(0, 100);
|
||||||
ui->w40->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc);
|
ui->w40->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc);
|
||||||
|
|
||||||
ui->w41->setRange(0, 100);
|
ui->w41->setRange(0, 100);
|
||||||
ui->w41->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Rectangle);
|
ui->w41->setDesignStyle(QQtCustomProgressBar::DesignStyle_Rectangle);
|
||||||
ui->w41->setBackgroundColor(QColor(36, 80, 100));
|
ui->w41->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w41->setRange(0, 100);
|
ui->w41->setRange(0, 100);
|
||||||
ui->w41->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Polo);
|
ui->w41->setPercentStyle(QQtCustomProgressBar::PercentStyle_Polo);
|
||||||
|
|
||||||
ui->w42->setRange(0, 100);
|
ui->w42->setRange(0, 100);
|
||||||
ui->w42->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Rectangle);
|
ui->w42->setDesignStyle(QQtCustomProgressBar::DesignStyle_Rectangle);
|
||||||
ui->w42->setBackgroundColor(QColor(36, 80, 100));
|
ui->w42->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w42->setRange(0, 100);
|
ui->w42->setRange(0, 100);
|
||||||
ui->w42->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc_Polo);
|
ui->w42->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc_Polo);
|
||||||
|
|
||||||
ui->w43->setRange(0, 80);
|
ui->w43->setRange(0, 80);
|
||||||
ui->w43->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Rectangle);
|
ui->w43->setDesignStyle(QQtCustomProgressBar::DesignStyle_Rectangle);
|
||||||
ui->w43->setBackgroundColor(QColor(20, 40, 100));
|
ui->w43->setBackgroundColor(QColor(20, 40, 100));
|
||||||
ui->w43->setWaveDensity(2);
|
ui->w43->setWaveDensity(2);
|
||||||
ui->w43->setWaveDirection(QQtCustomEffectProgressBar::WaveDirection_Left_Right);
|
ui->w43->setWaveDirection(QQtCustomProgressBar::WaveDirection_Left_Right);
|
||||||
ui->w43->setWaveHeight(2);
|
ui->w43->setWaveHeight(2);
|
||||||
ui->w43->setWaveSpeed(6);
|
ui->w43->setWaveSpeed(6);
|
||||||
ui->w43->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Wave);
|
ui->w43->setPercentStyle(QQtCustomProgressBar::PercentStyle_Wave);
|
||||||
|
|
||||||
ui->w50->setRange(0, 100);
|
ui->w50->setRange(0, 100);
|
||||||
ui->w50->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Square);
|
ui->w50->setDesignStyle(QQtCustomProgressBar::DesignStyle_Square);
|
||||||
ui->w50->setBackgroundColor(QColor(36, 80, 100));
|
ui->w50->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w50->setRange(0, 100);
|
ui->w50->setRange(0, 100);
|
||||||
ui->w50->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc);
|
ui->w50->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc);
|
||||||
|
|
||||||
ui->w51->setRange(0, 100);
|
ui->w51->setRange(0, 100);
|
||||||
ui->w51->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Square);
|
ui->w51->setDesignStyle(QQtCustomProgressBar::DesignStyle_Square);
|
||||||
ui->w51->setBackgroundColor(QColor(36, 80, 100));
|
ui->w51->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w51->setRange(0, 100);
|
ui->w51->setRange(0, 100);
|
||||||
ui->w51->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Polo);
|
ui->w51->setPercentStyle(QQtCustomProgressBar::PercentStyle_Polo);
|
||||||
|
|
||||||
ui->w52->setRange(0, 100);
|
ui->w52->setRange(0, 100);
|
||||||
ui->w52->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Square);
|
ui->w52->setDesignStyle(QQtCustomProgressBar::DesignStyle_Square);
|
||||||
ui->w52->setBackgroundColor(QColor(36, 80, 100));
|
ui->w52->setBackgroundColor(QColor(36, 80, 100));
|
||||||
ui->w52->setRange(0, 100);
|
ui->w52->setRange(0, 100);
|
||||||
ui->w52->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Arc_Polo);
|
ui->w52->setPercentStyle(QQtCustomProgressBar::PercentStyle_Arc_Polo);
|
||||||
|
|
||||||
ui->w53->setRange(0, 80);
|
ui->w53->setRange(0, 80);
|
||||||
ui->w53->setDesignStyle(QQtCustomEffectProgressBar::DesignStyle_Square);
|
ui->w53->setDesignStyle(QQtCustomProgressBar::DesignStyle_Square);
|
||||||
ui->w53->setBackgroundColor(QColor(20, 40, 100));
|
ui->w53->setBackgroundColor(QColor(20, 40, 100));
|
||||||
ui->w53->setWaveDensity(2);
|
ui->w53->setWaveDensity(2);
|
||||||
ui->w53->setWaveDirection(QQtCustomEffectProgressBar::WaveDirection_Left_Right);
|
ui->w53->setWaveDirection(QQtCustomProgressBar::WaveDirection_Left_Right);
|
||||||
ui->w53->setWaveHeight(2);
|
ui->w53->setWaveHeight(2);
|
||||||
ui->w53->setWaveSpeed(6);
|
ui->w53->setWaveSpeed(6);
|
||||||
ui->w53->setPercentStyle(QQtCustomEffectProgressBar::PercentStyle_Wave);
|
ui->w53->setPercentStyle(QQtCustomProgressBar::PercentStyle_Wave);
|
||||||
|
|
||||||
//ui->w60->setRange(0, 100);
|
//ui->w60->setRange(0, 100);
|
||||||
//ui->w60->setValue(100);
|
//ui->w60->setValue(100);
|
||||||
|
@ -26,16 +26,16 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w01" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w01" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w0" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w0" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w1" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w1" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w2" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w2" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -45,16 +45,16 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w5" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w5" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w6" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w6" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w3" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w3" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w4" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w4" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -64,16 +64,16 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w50" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w50" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w51" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w51" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w52" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w52" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w53" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w53" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -83,16 +83,16 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w40" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w40" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w41" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w41" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w42" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w42" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtCustomEffectProgressBar" name="w43" native="true"/>
|
<widget class="QQtCustomProgressBar" name="w43" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -160,7 +160,7 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QQtCustomEffectProgressBar</class>
|
<class>QQtCustomProgressBar</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header location="global">qqtcustomeffectprogressbar.h</header>
|
<header location="global">qqtcustomeffectprogressbar.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
|
@ -10,11 +10,11 @@ MainWindow::MainWindow ( QWidget* parent ) :
|
|||||||
ui->setupUi ( this );
|
ui->setupUi ( this );
|
||||||
/*
|
/*
|
||||||
ui->w60->setFixedHeight(30);
|
ui->w60->setFixedHeight(30);
|
||||||
QQtSlideEffectTabBar* bar = new QQtSlideEffectTabBar(ui->tab_6);
|
QQtSlideTabBar* bar = new QQtSlideTabBar(ui->tab_6);
|
||||||
QQtSlideEffectTabBar* bar2 = new QQtSlideEffectTabBar(ui->tab_6);
|
QQtSlideTabBar* bar2 = new QQtSlideTabBar(ui->tab_6);
|
||||||
bar->addTab("xxx");
|
bar->addTab("xxx");
|
||||||
bar->addTab("ccc");
|
bar->addTab("ccc");
|
||||||
bar2->setShape(QQtSlideEffectTabBar::RoundedEast);
|
bar2->setShape(QQtSlideTabBar::RoundedEast);
|
||||||
bar2->addTab("yyy");
|
bar2->addTab("yyy");
|
||||||
bar2->addTab("ddd");
|
bar2->addTab("ddd");
|
||||||
|
|
||||||
@ -28,10 +28,10 @@ MainWindow::MainWindow ( QWidget* parent ) :
|
|||||||
ui->tab_6->setLayout(lay);
|
ui->tab_6->setLayout(lay);
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
QQtSlideEffectTabBar* bar2 = new QQtSlideEffectTabBar(ui->tab_6);
|
QQtSlideTabBar* bar2 = new QQtSlideTabBar(ui->tab_6);
|
||||||
ui->tb1->setTabBar(bar2);
|
ui->tb1->setTabBar(bar2);
|
||||||
*/
|
*/
|
||||||
//QQtSlideEffectTabBar* bar = new QQtSlideEffectTabBar(ui->tb0);
|
//QQtSlideTabBar* bar = new QQtSlideTabBar(ui->tb0);
|
||||||
//ui->tb0->setTabBar(bar);
|
//ui->tb0->setTabBar(bar);
|
||||||
//ui->tb0->setObjectName("tb0");
|
//ui->tb0->setObjectName("tb0");
|
||||||
|
|
||||||
@ -41,15 +41,15 @@ MainWindow::MainWindow ( QWidget* parent ) :
|
|||||||
|
|
||||||
|
|
||||||
ui->tw0->setStyleSheet ( "QTabWidget#tw0 QTabBar::tab { width:72px; height:90px; }" );
|
ui->tw0->setStyleSheet ( "QTabWidget#tw0 QTabBar::tab { width:72px; height:90px; }" );
|
||||||
QQtPictureEffectTabBar* tab = ( QQtPictureEffectTabBar* ) ui->tw0->localTabBar();
|
QQtPictureTabBar* tab = ( QQtPictureTabBar* ) ui->tw0->localTabBar();
|
||||||
tab->setIconStyle ( QQtPictureEffectTabBar::IconStyle_Top_And_BottomText );
|
tab->setIconStyle ( QQtPictureTabBar::IconStyle_Top_And_BottomText );
|
||||||
tab->setTabPixmap ( 0, "./skin/default/bt_setting.png", "./skin/default/bt_setting_press.png" );
|
tab->setTabPixmap ( 0, "./skin/default/bt_setting.png", "./skin/default/bt_setting_press.png" );
|
||||||
tab->setTabPixmap ( 1, "./skin/default/bt_dispel.png", "./skin/default/bt_dispel_press.png" );
|
tab->setTabPixmap ( 1, "./skin/default/bt_dispel.png", "./skin/default/bt_dispel_press.png" );
|
||||||
tab->setContentsMargins ( 2, 2, 2, 2 );
|
tab->setContentsMargins ( 2, 2, 2, 2 );
|
||||||
|
|
||||||
ui->tw1->setStyleSheet ( "QTabWidget#tw1 QTabBar::tab { width:90px; height:30px; }" );
|
ui->tw1->setStyleSheet ( "QTabWidget#tw1 QTabBar::tab { width:90px; height:30px; }" );
|
||||||
QQtPictureEffectTabBar* tab1 = ( QQtPictureEffectTabBar* ) ui->tw1->localTabBar();
|
QQtPictureTabBar* tab1 = ( QQtPictureTabBar* ) ui->tw1->localTabBar();
|
||||||
tab1->setIconStyle ( QQtPictureEffectTabBar::IconStyle_Left_And_RightText );
|
tab1->setIconStyle ( QQtPictureTabBar::IconStyle_Left_And_RightText );
|
||||||
tab1->setTabPixmap ( 0, "./skin/default/bt_bt_hover.png", "./skin/default/bt_bt_press.png" );
|
tab1->setTabPixmap ( 0, "./skin/default/bt_bt_hover.png", "./skin/default/bt_bt_press.png" );
|
||||||
tab1->setTabIcon ( 0, "./skin/default/bk_user_normal.png", "./skin/default/bk_user_press.png" );
|
tab1->setTabIcon ( 0, "./skin/default/bk_user_normal.png", "./skin/default/bk_user_press.png" );
|
||||||
tab1->setTabPixmap ( 1, "./skin/default/bt_bt_hover.png", "./skin/default/bt_bt_press.png" );
|
tab1->setTabPixmap ( 1, "./skin/default/bt_bt_hover.png", "./skin/default/bt_bt_press.png" );
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Tab 2</string>
|
<string>Tab 2</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QQtSlideEffectTabBar" name="w77" native="true">
|
<widget class="QQtSlideTabBar" name="w77" native="true">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>30</x>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QQtSlideEffectTabWidget" name="tb0">
|
<widget class="QQtSlideTabWidget" name="tb0">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
@ -136,7 +136,7 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtPictureEffectTabWidget" name="tw0">
|
<widget class="QQtPictureTabWidget" name="tw0">
|
||||||
<property name="tabPosition">
|
<property name="tabPosition">
|
||||||
<enum>QTabWidget::West</enum>
|
<enum>QTabWidget::West</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -146,7 +146,7 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQtPictureEffectTabWidget" name="tw1">
|
<widget class="QQtPictureTabWidget" name="tw1">
|
||||||
<widget class="QWidget" name="tab_14">
|
<widget class="QWidget" name="tab_14">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Tab 1</string>
|
<string>Tab 1</string>
|
||||||
@ -184,19 +184,19 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QQtSlideEffectTabBar</class>
|
<class>QQtSlideTabBar</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>qqtslideeffecttabbar.h</header>
|
<header>qqtslideeffecttabbar.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QQtSlideEffectTabWidget</class>
|
<class>QQtSlideTabWidget</class>
|
||||||
<extends>QTabWidget</extends>
|
<extends>QTabWidget</extends>
|
||||||
<header location="global">qqtslideeffecttabwidget.h</header>
|
<header location="global">qqtslideeffecttabwidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QQtPictureEffectTabWidget</class>
|
<class>QQtPictureTabWidget</class>
|
||||||
<extends>QTabWidget</extends>
|
<extends>QTabWidget</extends>
|
||||||
<header location="global">qqtpictureeffecttabwidget.h</header>
|
<header location="global">qqtpictureeffecttabwidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
5. 购买LibQQt使用权付费规则:按照换取相同能量消耗当量的产品所需要的货币数量进行收费。
|
5. 购买LibQQt使用权付费规则:按照换取相同能量消耗当量的产品所需要的货币数量进行收费。
|
||||||
7. 为人工作进行收费。
|
7. 为人工作进行收费。
|
||||||
6. 农民种植作物、生产粮食劳动消耗能量最大,价值最高。
|
6. 农民种植作物、生产粮食劳动消耗能量最大,价值最高。
|
||||||
|
7. 用户有必要接受提供使用系统信息和崩溃日志给开发者进行改善程序所用。(手动调用HardwareInfo例程实现)
|
||||||
|
|
||||||
使用LibQQt,代表权力人接受以上规定。
|
使用LibQQt,代表权力人接受以上规定。
|
||||||
|
|
||||||
|
@ -93,7 +93,15 @@ contains (CONFIG, QQT_SOURCE_BUILDIN) {
|
|||||||
#link_from_sdk do move qqt to sdk path at app pre link command not lib build time
|
#link_from_sdk do move qqt to sdk path at app pre link command not lib build time
|
||||||
#mod qqt source to start post link is not needed here.
|
#mod qqt source to start post link is not needed here.
|
||||||
#need mod app souce after every pri mod.
|
#need mod app souce after every pri mod.
|
||||||
system("touch $${QQT_SOURCE_ROOT}/frame/qqtapplication.cpp")
|
#起初,qmake步骤被安置在QQt里,所以只有更改源代码才能启动POSTLINK.现在放置在App里了,这里的touch修改源代码不需要了.
|
||||||
|
#App修改源代码,Creator会自动qmake,启动qmake步骤PRILINK+POSTLINK
|
||||||
|
#App修改pro,必须手动qmake,Creator才会qmake,启动qmake步骤PRILINK+POSTLINK
|
||||||
|
#App必须注意,此处不再持续编译QQt.
|
||||||
|
#QQt持续编译配置开关
|
||||||
|
CONFIG += continued_build
|
||||||
|
contains(CONFIG, continued_build){
|
||||||
|
system("touch $${QQT_SOURCE_ROOT}/frame/qqtapplication.cpp")
|
||||||
|
}
|
||||||
include ($${QQT_SOURCE_ROOT}/qqt_install.pri)
|
include ($${QQT_SOURCE_ROOT}/qqt_install.pri)
|
||||||
|
|
||||||
#in this pri use QQT_SDK_ROOT QQT_SDK_PWD QQT_LIB_PWD
|
#in this pri use QQT_SDK_ROOT QQT_SDK_PWD QQT_LIB_PWD
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
#Ubuntu: /home/xxx/.qmake/app_configure.pri
|
#Ubuntu: /home/xxx/.qmake/app_configure.pri
|
||||||
#公共路径:应用编译路径、LibrarySDK路径、产品输出路径
|
#公共路径:应用编译路径、LibrarySDK路径、产品输出路径
|
||||||
|
|
||||||
|
#2018年5月3日 08点55分
|
||||||
|
#Multi-link技术只能应用于Qt5,Qt4没有windeployqt程序。
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------
|
||||||
#这个pri依赖qqt_function.pri
|
#这个pri依赖qqt_function.pri
|
||||||
#qqt_function.pri,哪里需要就在哪里包含。
|
#qqt_function.pri,哪里需要就在哪里包含。
|
||||||
|
@ -131,6 +131,20 @@ int QQtDictionary::count() const
|
|||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int QQtDictionary::size() const
|
||||||
|
{
|
||||||
|
int cnt = -1;
|
||||||
|
|
||||||
|
if ( DictList == m_type )
|
||||||
|
cnt = m_list.size();
|
||||||
|
else if ( DictMap == m_type )
|
||||||
|
cnt = m_map.size();
|
||||||
|
else if ( DictValue == m_type )
|
||||||
|
cnt = 1;
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
bool QQtDictionary::isNull() const
|
bool QQtDictionary::isNull() const
|
||||||
{
|
{
|
||||||
if ( m_type == DictMax )
|
if ( m_type == DictMax )
|
||||||
@ -141,8 +155,35 @@ bool QQtDictionary::isNull() const
|
|||||||
|
|
||||||
bool QQtDictionary::isValid() const
|
bool QQtDictionary::isValid() const
|
||||||
{
|
{
|
||||||
return isNull();
|
bool isValid = false;
|
||||||
|
|
||||||
|
switch ( m_type )
|
||||||
|
{
|
||||||
|
case DictValue:
|
||||||
|
if ( !m_value.isValid() )
|
||||||
|
isValid = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DictList:
|
||||||
|
if ( !m_list.isEmpty() )
|
||||||
|
isValid = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DictMap:
|
||||||
|
if ( !m_map.isEmpty() )
|
||||||
|
isValid = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtDictionary::isEmpty() const
|
bool QQtDictionary::isEmpty() const
|
||||||
{
|
{
|
||||||
bool isEmpty = true;
|
bool isEmpty = true;
|
||||||
@ -288,12 +329,12 @@ QQtDictionary& QQtDictionary::operator [] ( int index )
|
|||||||
//list size = 4, 最大index = 3。新 index = 4, 添加,新index才可以使用,否则out of range。
|
//list size = 4, 最大index = 3。新 index = 4, 添加,新index才可以使用,否则out of range。
|
||||||
if ( m_list.size() < index + 1 )
|
if ( m_list.size() < index + 1 )
|
||||||
{
|
{
|
||||||
int cnt = m_list.count();
|
int cnt = m_list.size();
|
||||||
|
|
||||||
/*相差的数量*///count -> index+1 = index+1 - count
|
/*相差的数量*///count -> index+1 = index+1 - count
|
||||||
|
|
||||||
for ( int i = 0; i < index + 1 - cnt; i++ )
|
for ( int i = 0; i < index + 1 - cnt; i++ )
|
||||||
m_list.append ( QQtDictionary() );
|
m_list.push_back ( QQtDictionary() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( QQtDictionary& ) m_list.operator [] ( index );
|
return ( QQtDictionary& ) m_list.operator [] ( index );
|
||||||
@ -375,11 +416,16 @@ QList<QQtDictionary>& QQtDictionary::getList() const
|
|||||||
return ( QList<QQtDictionary>& ) m_list;
|
return ( QList<QQtDictionary>& ) m_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant& QQtDictionary::getValue() const
|
QVariant& QQtDictionary::getValue()
|
||||||
{
|
{
|
||||||
return ( QVariant& ) m_value;
|
return ( QVariant& ) m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QVariant& QQtDictionary::getValue() const
|
||||||
|
{
|
||||||
|
return ( const QVariant& ) m_value;
|
||||||
|
}
|
||||||
|
|
||||||
QQtDictionary& QQtDictionary::getChild ( int index )
|
QQtDictionary& QQtDictionary::getChild ( int index )
|
||||||
{
|
{
|
||||||
return m_list[index];
|
return m_list[index];
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
|
|
||||||
/*遍历字典*/
|
/*遍历字典*/
|
||||||
int count() const;
|
int count() const;
|
||||||
|
int size() const;
|
||||||
|
|
||||||
bool hasChild ( const QString& key ) const;
|
bool hasChild ( const QString& key ) const;
|
||||||
bool hasChild ( const QQtDictionary& value ) const;
|
bool hasChild ( const QQtDictionary& value ) const;
|
||||||
@ -77,7 +78,8 @@ public:
|
|||||||
|
|
||||||
/*获取单个数据*/
|
/*获取单个数据*/
|
||||||
/*保存为value的*/
|
/*保存为value的*/
|
||||||
QVariant& getValue() const;
|
QVariant& getValue();
|
||||||
|
const QVariant& getValue() const;
|
||||||
QQtDictionary& getChild ( int index );
|
QQtDictionary& getChild ( int index );
|
||||||
QQtDictionary& getChild ( const QString& key );
|
QQtDictionary& getChild ( const QString& key );
|
||||||
/*获取一个个孩子*/
|
/*获取一个个孩子*/
|
||||||
|
21
src/exquisite/colorwidgets/qqtcolorlabel.cpp
Normal file
21
src/exquisite/colorwidgets/qqtcolorlabel.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "qqtcolorlabel.h"
|
||||||
|
|
||||||
|
QQtColorLabel::QQtColorLabel ( QWidget* parent ) : QLabel ( parent )
|
||||||
|
{
|
||||||
|
setStyleSheet ( "QLabel{background-color:#FFFFFF;}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtColorLabel::setColor ( const QRgb& rgb )
|
||||||
|
{
|
||||||
|
mRgb = rgb;
|
||||||
|
QString colorString = QString ( "QLabel{background-color:#%1%2%3;}" )
|
||||||
|
.arg ( qRed ( rgb ), 2, 16, QChar ( '0' ) )
|
||||||
|
.arg ( qGreen ( rgb ), 2, 16, QChar ( '0' ) )
|
||||||
|
.arg ( qBlue ( rgb ), 2, 16, QChar ( '0' ) );
|
||||||
|
setStyleSheet ( colorString );
|
||||||
|
}
|
||||||
|
|
||||||
|
QRgb QQtColorLabel::getColor()
|
||||||
|
{
|
||||||
|
return mRgb;
|
||||||
|
}
|
28
src/exquisite/colorwidgets/qqtcolorlabel.h
Normal file
28
src/exquisite/colorwidgets/qqtcolorlabel.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef QQTCOLORLABEL_H
|
||||||
|
#define QQTCOLORLABEL_H
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QRgb>
|
||||||
|
|
||||||
|
#include <qqt-local.h>
|
||||||
|
#include <qqtcore.h>
|
||||||
|
|
||||||
|
class QQTSHARED_EXPORT QQtColorLabel : public QLabel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtColorLabel ( QWidget* parent = nullptr );
|
||||||
|
virtual ~QQtColorLabel() {}
|
||||||
|
|
||||||
|
void setColor ( const QRgb& rgb );
|
||||||
|
|
||||||
|
QRgb getColor();
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRgb mRgb;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTCOLORLABEL_H
|
21
src/exquisite/colorwidgets/qqtcolorwidget.cpp
Normal file
21
src/exquisite/colorwidgets/qqtcolorwidget.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "qqtcolorwidget.h"
|
||||||
|
|
||||||
|
QQtColorWidget::QQtColorWidget ( QWidget* parent ) : QWidget ( parent )
|
||||||
|
{
|
||||||
|
setStyleSheet ( "QWidget{background-color:#FFFFFF;}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtColorWidget::setColor ( const QRgb& rgb )
|
||||||
|
{
|
||||||
|
mRgb = rgb;
|
||||||
|
QString colorString = QString ( "QWidget{background-color:#%1%2%3;}" )
|
||||||
|
.arg ( qRed ( rgb ), 2, 16, QChar ( '0' ) )
|
||||||
|
.arg ( qGreen ( rgb ), 2, 16, QChar ( '0' ) )
|
||||||
|
.arg ( qBlue ( rgb ), 2, 16, QChar ( '0' ) );
|
||||||
|
setStyleSheet ( colorString );
|
||||||
|
}
|
||||||
|
|
||||||
|
QRgb QQtColorWidget::getColor()
|
||||||
|
{
|
||||||
|
return mRgb;
|
||||||
|
}
|
27
src/exquisite/colorwidgets/qqtcolorwidget.h
Normal file
27
src/exquisite/colorwidgets/qqtcolorwidget.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef QQTCOLORWIDGET_H
|
||||||
|
#define QQTCOLORWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <qqt-local.h>
|
||||||
|
#include <qqtcore.h>
|
||||||
|
|
||||||
|
class QQTSHARED_EXPORT QQtColorWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtColorWidget ( QWidget* parent = nullptr );
|
||||||
|
virtual ~QQtColorWidget() {}
|
||||||
|
|
||||||
|
void setColor ( const QRgb& rgb );
|
||||||
|
|
||||||
|
QRgb getColor();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
private:
|
||||||
|
QRgb mRgb;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTCOLORWIDGET_H
|
@ -2,13 +2,13 @@
|
|||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "qqtcustomeffectprogressbar.h"
|
#include "qqtcustomprogressbar.h"
|
||||||
#include "qpainter.h"
|
#include "qpainter.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
#include "qmath.h"
|
#include "qmath.h"
|
||||||
#include "qtimer.h"
|
#include "qtimer.h"
|
||||||
|
|
||||||
QQtCustomEffectProgressBar::QQtCustomEffectProgressBar ( QWidget* parent ) : QWidget ( parent )
|
QQtCustomProgressBar::QQtCustomProgressBar ( QWidget* parent ) : QWidget ( parent )
|
||||||
{
|
{
|
||||||
minValue = 0;
|
minValue = 0;
|
||||||
maxValue = 100;
|
maxValue = 100;
|
||||||
@ -18,6 +18,7 @@ QQtCustomEffectProgressBar::QQtCustomEffectProgressBar ( QWidget* parent ) : QWi
|
|||||||
nullPosition = 0;
|
nullPosition = 0;
|
||||||
lineWidth = 10;
|
lineWidth = 10;
|
||||||
cornerRadius = 10;
|
cornerRadius = 10;
|
||||||
|
lineCapStyle = Qt::RoundCap;
|
||||||
|
|
||||||
showPercent = true;
|
showPercent = true;
|
||||||
showFree = false;
|
showFree = false;
|
||||||
@ -49,11 +50,11 @@ QQtCustomEffectProgressBar::QQtCustomEffectProgressBar ( QWidget* parent ) : QWi
|
|||||||
connect ( timer, SIGNAL ( timeout() ), this, SLOT ( update() ) );
|
connect ( timer, SIGNAL ( timeout() ), this, SLOT ( update() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtCustomEffectProgressBar::~QQtCustomEffectProgressBar()
|
QQtCustomProgressBar::~QQtCustomProgressBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::paintEvent ( QPaintEvent* )
|
void QQtCustomProgressBar::paintEvent ( QPaintEvent* )
|
||||||
{
|
{
|
||||||
int width = this->width();
|
int width = this->width();
|
||||||
int height = this->height();
|
int height = this->height();
|
||||||
@ -112,7 +113,7 @@ void QQtCustomEffectProgressBar::paintEvent ( QPaintEvent* )
|
|||||||
drawPercentText ( &painter, 100 );
|
drawPercentText ( &painter, 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::drawBackground ( QPainter* painter, int radius )
|
void QQtCustomProgressBar::drawBackground ( QPainter* painter, int radius )
|
||||||
{
|
{
|
||||||
if ( percentStyle == PercentStyle_Arc )
|
if ( percentStyle == PercentStyle_Arc )
|
||||||
{
|
{
|
||||||
@ -153,7 +154,7 @@ void QQtCustomEffectProgressBar::drawBackground ( QPainter* painter, int radius
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::drawArc ( QPainter* painter, int radius )
|
void QQtCustomProgressBar::drawArc ( QPainter* painter, int radius )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setBrush ( Qt::NoBrush );
|
painter->setBrush ( Qt::NoBrush );
|
||||||
@ -162,7 +163,7 @@ void QQtCustomEffectProgressBar::drawArc ( QPainter* painter, int radius )
|
|||||||
pen.setWidthF ( lineWidth );
|
pen.setWidthF ( lineWidth );
|
||||||
|
|
||||||
/*这里可以更改画笔样式更换线条风格*/
|
/*这里可以更改画笔样式更换线条风格*/
|
||||||
pen.setCapStyle ( Qt::RoundCap );
|
pen.setCapStyle ( ( Qt::PenCapStyle ) lineCapStyle );
|
||||||
|
|
||||||
double arcLength = 360.0 / ( maxValue - minValue ) * ( value - minValue );
|
double arcLength = 360.0 / ( maxValue - minValue ) * ( value - minValue );
|
||||||
QRect rect ( -radius, -radius, radius * 2, radius * 2 );
|
QRect rect ( -radius, -radius, radius * 2, radius * 2 );
|
||||||
@ -201,7 +202,7 @@ void QQtCustomEffectProgressBar::drawArc ( QPainter* painter, int radius )
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::drawPolo ( QPainter* painter, int radius )
|
void QQtCustomProgressBar::drawPolo ( QPainter* painter, int radius )
|
||||||
{
|
{
|
||||||
/*计算当前值所占百分比对应高度*/
|
/*计算当前值所占百分比对应高度*/
|
||||||
double poloHeight = ( double ) radius / ( maxValue - minValue ) * ( value - minValue ) ;
|
double poloHeight = ( double ) radius / ( maxValue - minValue ) * ( value - minValue ) ;
|
||||||
@ -234,7 +235,7 @@ void QQtCustomEffectProgressBar::drawPolo ( QPainter* painter, int radius )
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::drawWave ( QPainter* painter, int radius )
|
void QQtCustomProgressBar::drawWave ( QPainter* painter, int radius )
|
||||||
{
|
{
|
||||||
/*大路径*/
|
/*大路径*/
|
||||||
QPainterPath bigPath;
|
QPainterPath bigPath;
|
||||||
@ -372,7 +373,7 @@ void QQtCustomEffectProgressBar::drawWave ( QPainter* painter, int radius )
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::drawText ( QPainter* painter, int radius )
|
void QQtCustomProgressBar::drawText ( QPainter* painter, int radius )
|
||||||
{
|
{
|
||||||
QString strText = QString ( "%1" ).arg ( text );
|
QString strText = QString ( "%1" ).arg ( text );
|
||||||
|
|
||||||
@ -398,7 +399,7 @@ void QQtCustomEffectProgressBar::drawText ( QPainter* painter, int radius )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::drawPercentText ( QPainter* painter, int radius )
|
void QQtCustomProgressBar::drawPercentText ( QPainter* painter, int radius )
|
||||||
{
|
{
|
||||||
QString strValue = QString ( "%1" ).arg ( value - minValue );
|
QString strValue = QString ( "%1" ).arg ( value - minValue );
|
||||||
|
|
||||||
@ -440,97 +441,97 @@ void QQtCustomEffectProgressBar::drawPercentText ( QPainter* painter, int radius
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtCustomEffectProgressBar::getMinValue() const
|
int QQtCustomProgressBar::getMinValue() const
|
||||||
{
|
{
|
||||||
return this->minValue;
|
return this->minValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtCustomEffectProgressBar::getMaxValue() const
|
int QQtCustomProgressBar::getMaxValue() const
|
||||||
{
|
{
|
||||||
return this->maxValue;
|
return this->maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtCustomEffectProgressBar::getValue() const
|
int QQtCustomProgressBar::getValue() const
|
||||||
{
|
{
|
||||||
return this->value;
|
return this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtCustomEffectProgressBar::getNullPosition() const
|
int QQtCustomProgressBar::getNullPosition() const
|
||||||
{
|
{
|
||||||
return this->nullPosition;
|
return this->nullPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtCustomEffectProgressBar::getLineWidth() const
|
int QQtCustomProgressBar::getLineWidth() const
|
||||||
{
|
{
|
||||||
return this->lineWidth;
|
return this->lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtCustomEffectProgressBar::getShowPercent() const
|
bool QQtCustomProgressBar::getShowPercent() const
|
||||||
{
|
{
|
||||||
return this->showPercent;
|
return this->showPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtCustomEffectProgressBar::getShowFree() const
|
bool QQtCustomProgressBar::getShowFree() const
|
||||||
{
|
{
|
||||||
return this->showFree;
|
return this->showFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtCustomEffectProgressBar::getShowSmallCircle() const
|
bool QQtCustomProgressBar::getShowSmallCircle() const
|
||||||
{
|
{
|
||||||
return this->showSmallCircle;
|
return this->showSmallCircle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtCustomEffectProgressBar::getClockWise() const
|
bool QQtCustomProgressBar::getClockWise() const
|
||||||
{
|
{
|
||||||
return this->clockWise;
|
return this->clockWise;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QQtCustomEffectProgressBar::getUsedColor() const
|
QColor QQtCustomProgressBar::getUsedColor() const
|
||||||
{
|
{
|
||||||
return this->usedColor;
|
return this->usedColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QQtCustomEffectProgressBar::getFreeColor() const
|
QColor QQtCustomProgressBar::getFreeColor() const
|
||||||
{
|
{
|
||||||
return this->freeColor;
|
return this->freeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QQtCustomEffectProgressBar::getBackgroundColor() const
|
QColor QQtCustomProgressBar::getBackgroundColor() const
|
||||||
{
|
{
|
||||||
return this->backgroundColor;
|
return this->backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QQtCustomEffectProgressBar::getTextColor() const
|
QColor QQtCustomProgressBar::getTextColor() const
|
||||||
{
|
{
|
||||||
return this->textColor;
|
return this->textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QQtCustomEffectProgressBar::getPercentSuffix() const
|
QString QQtCustomProgressBar::getPercentSuffix() const
|
||||||
{
|
{
|
||||||
return this->percentSuffix;
|
return this->percentSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtCustomEffectProgressBar::PercentStyle QQtCustomEffectProgressBar::getPercentStyle() const
|
QQtCustomProgressBar::PercentStyle QQtCustomProgressBar::getPercentStyle() const
|
||||||
{
|
{
|
||||||
return this->percentStyle;
|
return this->percentStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtCustomEffectProgressBar::BackgroundType QQtCustomEffectProgressBar::getBackgroundType() const
|
QQtCustomProgressBar::BackgroundType QQtCustomProgressBar::getBackgroundType() const
|
||||||
{
|
{
|
||||||
return this->backgroundType;
|
return this->backgroundType;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize QQtCustomEffectProgressBar::sizeHint() const
|
QSize QQtCustomProgressBar::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize ( 200, 200 );
|
return QSize ( 200, 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize QQtCustomEffectProgressBar::minimumSizeHint() const
|
QSize QQtCustomProgressBar::minimumSizeHint() const
|
||||||
{
|
{
|
||||||
return QSize ( 10, 10 );
|
return QSize ( 10, 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setRange ( int minValue, int maxValue )
|
void QQtCustomProgressBar::setRange ( int minValue, int maxValue )
|
||||||
{
|
{
|
||||||
/*如果最小值大于或者等于最大值则不设置*/
|
/*如果最小值大于或者等于最大值则不设置*/
|
||||||
if ( minValue >= maxValue )
|
if ( minValue >= maxValue )
|
||||||
@ -550,17 +551,17 @@ void QQtCustomEffectProgressBar::setRange ( int minValue, int maxValue )
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setMinValue ( int minValue )
|
void QQtCustomProgressBar::setMinValue ( int minValue )
|
||||||
{
|
{
|
||||||
setRange ( minValue, maxValue );
|
setRange ( minValue, maxValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setMaxValue ( int maxValue )
|
void QQtCustomProgressBar::setMaxValue ( int maxValue )
|
||||||
{
|
{
|
||||||
setRange ( minValue, maxValue );
|
setRange ( minValue, maxValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setValue ( int value )
|
void QQtCustomProgressBar::setValue ( int value )
|
||||||
{
|
{
|
||||||
/*值小于最小值或者值大于最大值或者值和当前值一致则无需处理*/
|
/*值小于最小值或者值大于最大值或者值和当前值一致则无需处理*/
|
||||||
if ( value < minValue || value > maxValue || value == this->value )
|
if ( value < minValue || value > maxValue || value == this->value )
|
||||||
@ -573,7 +574,7 @@ void QQtCustomEffectProgressBar::setValue ( int value )
|
|||||||
emit valueChanged ( value );
|
emit valueChanged ( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setNullPosition ( int nullPosition )
|
void QQtCustomProgressBar::setNullPosition ( int nullPosition )
|
||||||
{
|
{
|
||||||
if ( this->nullPosition != nullPosition )
|
if ( this->nullPosition != nullPosition )
|
||||||
{
|
{
|
||||||
@ -582,7 +583,7 @@ void QQtCustomEffectProgressBar::setNullPosition ( int nullPosition )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setLineWidth ( int lineWidth )
|
void QQtCustomProgressBar::setLineWidth ( int lineWidth )
|
||||||
{
|
{
|
||||||
if ( this->lineWidth != lineWidth )
|
if ( this->lineWidth != lineWidth )
|
||||||
{
|
{
|
||||||
@ -591,7 +592,16 @@ void QQtCustomEffectProgressBar::setLineWidth ( int lineWidth )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setShowPercent ( bool showPercent )
|
void QQtCustomProgressBar::setLineCapStyle ( int lineCapStyle )
|
||||||
|
{
|
||||||
|
if ( this->lineCapStyle != lineCapStyle )
|
||||||
|
{
|
||||||
|
this->lineCapStyle = lineCapStyle;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtCustomProgressBar::setShowPercent ( bool showPercent )
|
||||||
{
|
{
|
||||||
if ( this->showPercent != showPercent )
|
if ( this->showPercent != showPercent )
|
||||||
{
|
{
|
||||||
@ -600,7 +610,7 @@ void QQtCustomEffectProgressBar::setShowPercent ( bool showPercent )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setPercentSuffix ( QString percentSuffix )
|
void QQtCustomProgressBar::setPercentSuffix ( QString percentSuffix )
|
||||||
{
|
{
|
||||||
if ( this->percentSuffix != percentSuffix )
|
if ( this->percentSuffix != percentSuffix )
|
||||||
{
|
{
|
||||||
@ -609,7 +619,7 @@ void QQtCustomEffectProgressBar::setPercentSuffix ( QString percentSuffix )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setShowFree ( bool showFree )
|
void QQtCustomProgressBar::setShowFree ( bool showFree )
|
||||||
{
|
{
|
||||||
if ( this->showFree != showFree )
|
if ( this->showFree != showFree )
|
||||||
{
|
{
|
||||||
@ -618,7 +628,7 @@ void QQtCustomEffectProgressBar::setShowFree ( bool showFree )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setShowSmallCircle ( bool showSmallCircle )
|
void QQtCustomProgressBar::setShowSmallCircle ( bool showSmallCircle )
|
||||||
{
|
{
|
||||||
if ( this->showSmallCircle != showSmallCircle )
|
if ( this->showSmallCircle != showSmallCircle )
|
||||||
{
|
{
|
||||||
@ -627,7 +637,7 @@ void QQtCustomEffectProgressBar::setShowSmallCircle ( bool showSmallCircle )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setClockWise ( bool clockWise )
|
void QQtCustomProgressBar::setClockWise ( bool clockWise )
|
||||||
{
|
{
|
||||||
if ( this->clockWise != clockWise )
|
if ( this->clockWise != clockWise )
|
||||||
{
|
{
|
||||||
@ -636,7 +646,7 @@ void QQtCustomEffectProgressBar::setClockWise ( bool clockWise )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setUsedColor ( const QColor& usedColor )
|
void QQtCustomProgressBar::setUsedColor ( const QColor& usedColor )
|
||||||
{
|
{
|
||||||
if ( this->usedColor != usedColor )
|
if ( this->usedColor != usedColor )
|
||||||
{
|
{
|
||||||
@ -645,7 +655,7 @@ void QQtCustomEffectProgressBar::setUsedColor ( const QColor& usedColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setFreeColor ( const QColor& freeColor )
|
void QQtCustomProgressBar::setFreeColor ( const QColor& freeColor )
|
||||||
{
|
{
|
||||||
if ( this->freeColor != freeColor )
|
if ( this->freeColor != freeColor )
|
||||||
{
|
{
|
||||||
@ -654,7 +664,7 @@ void QQtCustomEffectProgressBar::setFreeColor ( const QColor& freeColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setBackgroundColor ( const QColor& backgroundColor )
|
void QQtCustomProgressBar::setBackgroundColor ( const QColor& backgroundColor )
|
||||||
{
|
{
|
||||||
if ( this->backgroundColor != backgroundColor )
|
if ( this->backgroundColor != backgroundColor )
|
||||||
{
|
{
|
||||||
@ -663,7 +673,7 @@ void QQtCustomEffectProgressBar::setBackgroundColor ( const QColor& backgroundCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setBackgroundImage ( const QString& backgroundImage )
|
void QQtCustomProgressBar::setBackgroundImage ( const QString& backgroundImage )
|
||||||
{
|
{
|
||||||
if ( this->backgroundImage != backgroundImage )
|
if ( this->backgroundImage != backgroundImage )
|
||||||
{
|
{
|
||||||
@ -672,7 +682,7 @@ void QQtCustomEffectProgressBar::setBackgroundImage ( const QString& backgroundI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setText ( const QString& text )
|
void QQtCustomProgressBar::setText ( const QString& text )
|
||||||
{
|
{
|
||||||
if ( this->text != text )
|
if ( this->text != text )
|
||||||
{
|
{
|
||||||
@ -681,7 +691,7 @@ void QQtCustomEffectProgressBar::setText ( const QString& text )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setTextColor ( const QColor& textColor )
|
void QQtCustomProgressBar::setTextColor ( const QColor& textColor )
|
||||||
{
|
{
|
||||||
if ( this->textColor != textColor )
|
if ( this->textColor != textColor )
|
||||||
{
|
{
|
||||||
@ -690,7 +700,7 @@ void QQtCustomEffectProgressBar::setTextColor ( const QColor& textColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setTextFont ( QFont font )
|
void QQtCustomProgressBar::setTextFont ( QFont font )
|
||||||
{
|
{
|
||||||
if ( this->textFont != font )
|
if ( this->textFont != font )
|
||||||
{
|
{
|
||||||
@ -699,7 +709,7 @@ void QQtCustomEffectProgressBar::setTextFont ( QFont font )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setPercentTextColor ( const QColor& percentColor )
|
void QQtCustomProgressBar::setPercentTextColor ( const QColor& percentColor )
|
||||||
{
|
{
|
||||||
if ( this->percentColor != percentColor )
|
if ( this->percentColor != percentColor )
|
||||||
{
|
{
|
||||||
@ -708,7 +718,7 @@ void QQtCustomEffectProgressBar::setPercentTextColor ( const QColor& percentColo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setPercentTextFont ( QFont percentFont )
|
void QQtCustomProgressBar::setPercentTextFont ( QFont percentFont )
|
||||||
{
|
{
|
||||||
if ( this->percentFont != percentFont )
|
if ( this->percentFont != percentFont )
|
||||||
{
|
{
|
||||||
@ -717,7 +727,7 @@ void QQtCustomEffectProgressBar::setPercentTextFont ( QFont percentFont )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setCornerRadius ( int cornerRadius )
|
void QQtCustomProgressBar::setCornerRadius ( int cornerRadius )
|
||||||
{
|
{
|
||||||
if ( this->cornerRadius != cornerRadius )
|
if ( this->cornerRadius != cornerRadius )
|
||||||
{
|
{
|
||||||
@ -726,7 +736,7 @@ void QQtCustomEffectProgressBar::setCornerRadius ( int cornerRadius )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setTextStyle ( QQtCustomEffectProgressBar::TextStyle textStyle )
|
void QQtCustomProgressBar::setTextStyle ( QQtCustomProgressBar::TextStyle textStyle )
|
||||||
{
|
{
|
||||||
if ( this->textStyle != textStyle )
|
if ( this->textStyle != textStyle )
|
||||||
{
|
{
|
||||||
@ -735,7 +745,7 @@ void QQtCustomEffectProgressBar::setTextStyle ( QQtCustomEffectProgressBar::Text
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setDesignStyle ( QQtCustomEffectProgressBar::DesignStyle designStyle )
|
void QQtCustomProgressBar::setDesignStyle ( QQtCustomProgressBar::DesignStyle designStyle )
|
||||||
{
|
{
|
||||||
if ( this->designStyle != designStyle )
|
if ( this->designStyle != designStyle )
|
||||||
{
|
{
|
||||||
@ -746,7 +756,7 @@ void QQtCustomEffectProgressBar::setDesignStyle ( QQtCustomEffectProgressBar::De
|
|||||||
|
|
||||||
#define TIMER_FIELD 600
|
#define TIMER_FIELD 600
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setPercentStyle ( QQtCustomEffectProgressBar::PercentStyle percentStyle )
|
void QQtCustomProgressBar::setPercentStyle ( QQtCustomProgressBar::PercentStyle percentStyle )
|
||||||
{
|
{
|
||||||
if ( this->percentStyle != percentStyle )
|
if ( this->percentStyle != percentStyle )
|
||||||
{
|
{
|
||||||
@ -761,7 +771,7 @@ void QQtCustomEffectProgressBar::setPercentStyle ( QQtCustomEffectProgressBar::P
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setBackgroundType ( QQtCustomEffectProgressBar::BackgroundType backgroundType )
|
void QQtCustomProgressBar::setBackgroundType ( QQtCustomProgressBar::BackgroundType backgroundType )
|
||||||
{
|
{
|
||||||
if ( this->backgroundType != backgroundType )
|
if ( this->backgroundType != backgroundType )
|
||||||
{
|
{
|
||||||
@ -770,7 +780,7 @@ void QQtCustomEffectProgressBar::setBackgroundType ( QQtCustomEffectProgressBar:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setWaveDensity ( int value )
|
void QQtCustomProgressBar::setWaveDensity ( int value )
|
||||||
{
|
{
|
||||||
if ( value < 1 )
|
if ( value < 1 )
|
||||||
value = 1;
|
value = 1;
|
||||||
@ -782,7 +792,7 @@ void QQtCustomEffectProgressBar::setWaveDensity ( int value )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setWaveHeight ( int value )
|
void QQtCustomProgressBar::setWaveHeight ( int value )
|
||||||
{
|
{
|
||||||
if ( value < 1 )
|
if ( value < 1 )
|
||||||
value = 1;
|
value = 1;
|
||||||
@ -794,7 +804,7 @@ void QQtCustomEffectProgressBar::setWaveHeight ( int value )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setWaveDirection ( WaveDirection direction )
|
void QQtCustomProgressBar::setWaveDirection ( WaveDirection direction )
|
||||||
{
|
{
|
||||||
if ( this->waveDirection != direction )
|
if ( this->waveDirection != direction )
|
||||||
{
|
{
|
||||||
@ -803,7 +813,7 @@ void QQtCustomEffectProgressBar::setWaveDirection ( WaveDirection direction )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::setWaveSpeed ( int speed )
|
void QQtCustomProgressBar::setWaveSpeed ( int speed )
|
||||||
{
|
{
|
||||||
if ( speed < 1 )
|
if ( speed < 1 )
|
||||||
speed = 1;
|
speed = 1;
|
||||||
@ -817,13 +827,13 @@ void QQtCustomEffectProgressBar::setWaveSpeed ( int speed )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::mouseReleaseEvent ( QMouseEvent* event )
|
void QQtCustomProgressBar::mouseReleaseEvent ( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
emit click();
|
emit click();
|
||||||
return QWidget::mouseReleaseEvent ( event );
|
return QWidget::mouseReleaseEvent ( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtCustomEffectProgressBar::mouseDoubleClickEvent ( QMouseEvent* event )
|
void QQtCustomProgressBar::mouseDoubleClickEvent ( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
emit doubleClick();
|
emit doubleClick();
|
||||||
return QWidget::mouseDoubleClickEvent ( event );
|
return QWidget::mouseDoubleClickEvent ( event );
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTCUSTOMEFFECTPROGRESSBAR_H
|
#ifndef QQTCUSTOMPROGRESSBAR_H
|
||||||
#define QQTCUSTOMEFFECTPROGRESSBAR_H
|
#define QQTCUSTOMPROGRESSBAR_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) mod 2017年10月20日19:10:53
|
* T.D.R (QQ:2657635903) mod 2017年10月20日19:10:53
|
||||||
@ -35,45 +35,46 @@
|
|||||||
#include <QtUiPlugin/QDesignerExportWidget>
|
#include <QtUiPlugin/QDesignerExportWidget>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class QDESIGNER_WIDGET_EXPORT QQtCustomEffectProgressBar : public QWidget
|
class QDESIGNER_WIDGET_EXPORT QQtCustomProgressBar : public QWidget
|
||||||
#else
|
#else
|
||||||
class QQTSHARED_EXPORT QQtCustomEffectProgressBar : public QWidget
|
class QQTSHARED_EXPORT QQtCustomProgressBar : public QWidget
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(WaveDirection)
|
Q_ENUMS ( WaveDirection )
|
||||||
Q_ENUMS(BackgroundType)
|
Q_ENUMS ( BackgroundType )
|
||||||
Q_ENUMS(PercentStyle)
|
Q_ENUMS ( PercentStyle )
|
||||||
Q_ENUMS(DesignStyle)
|
Q_ENUMS ( DesignStyle )
|
||||||
Q_ENUMS(TextStyle)
|
Q_ENUMS ( TextStyle )
|
||||||
|
|
||||||
Q_PROPERTY(int minValue READ getMinValue WRITE setMinValue)
|
Q_PROPERTY ( int minValue READ getMinValue WRITE setMinValue )
|
||||||
Q_PROPERTY(int maxValue READ getMaxValue WRITE setMaxValue)
|
Q_PROPERTY ( int maxValue READ getMaxValue WRITE setMaxValue )
|
||||||
Q_PROPERTY(int value READ getValue WRITE setValue)
|
Q_PROPERTY ( int value READ getValue WRITE setValue )
|
||||||
|
|
||||||
Q_PROPERTY(int nullPosition READ getNullPosition WRITE setNullPosition)
|
Q_PROPERTY ( int nullPosition READ getNullPosition WRITE setNullPosition )
|
||||||
Q_PROPERTY(int lineWidth READ getLineWidth WRITE setLineWidth)
|
Q_PROPERTY ( int lineWidth READ getLineWidth WRITE setLineWidth )
|
||||||
Q_PROPERTY(int cornerRadius READ getCornerRaduis WRITE setCornerRadius)
|
Q_PROPERTY ( int cornerRadius READ getCornerRaduis WRITE setCornerRadius )
|
||||||
|
Q_PROPERTY ( int lineCapStyle READ getLineCapStyle WRITE setLineCapStyle )
|
||||||
|
|
||||||
Q_PROPERTY(bool showPercent READ getShowPercent WRITE setShowPercent)
|
Q_PROPERTY ( bool showPercent READ getShowPercent WRITE setShowPercent )
|
||||||
Q_PROPERTY(bool showFree READ getShowFree WRITE setShowFree)
|
Q_PROPERTY ( bool showFree READ getShowFree WRITE setShowFree )
|
||||||
Q_PROPERTY(bool showSmallCircle READ getShowSmallCircle WRITE setShowSmallCircle)
|
Q_PROPERTY ( bool showSmallCircle READ getShowSmallCircle WRITE setShowSmallCircle )
|
||||||
Q_PROPERTY(bool clockWise READ getClockWise WRITE setClockWise)
|
Q_PROPERTY ( bool clockWise READ getClockWise WRITE setClockWise )
|
||||||
|
|
||||||
Q_PROPERTY(QColor usedColor READ getUsedColor WRITE setUsedColor)
|
Q_PROPERTY ( QColor usedColor READ getUsedColor WRITE setUsedColor )
|
||||||
Q_PROPERTY(QColor freeColor READ getFreeColor WRITE setFreeColor)
|
Q_PROPERTY ( QColor freeColor READ getFreeColor WRITE setFreeColor )
|
||||||
Q_PROPERTY(QColor backgroundColor READ getBackgroundColor WRITE setBackgroundColor)
|
Q_PROPERTY ( QColor backgroundColor READ getBackgroundColor WRITE setBackgroundColor )
|
||||||
Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor)
|
Q_PROPERTY ( QColor textColor READ getTextColor WRITE setTextColor )
|
||||||
Q_PROPERTY(QFont textFont READ getTextFont WRITE setTextFont)
|
Q_PROPERTY ( QFont textFont READ getTextFont WRITE setTextFont )
|
||||||
Q_PROPERTY(QColor percentColor READ getPercentTextColor WRITE setPercentTextColor)
|
Q_PROPERTY ( QColor percentColor READ getPercentTextColor WRITE setPercentTextColor )
|
||||||
Q_PROPERTY(QFont percentFont READ getPercentTextFont WRITE setPercentTextFont)
|
Q_PROPERTY ( QFont percentFont READ getPercentTextFont WRITE setPercentTextFont )
|
||||||
Q_PROPERTY(QString percentSuffix READ getPercentSuffix WRITE setPercentSuffix)
|
Q_PROPERTY ( QString percentSuffix READ getPercentSuffix WRITE setPercentSuffix )
|
||||||
Q_PROPERTY(QString text READ getText WRITE setText)
|
Q_PROPERTY ( QString text READ getText WRITE setText )
|
||||||
|
|
||||||
Q_PROPERTY(int waveDensity READ getWaveDensity WRITE setWaveDensity)
|
Q_PROPERTY ( int waveDensity READ getWaveDensity WRITE setWaveDensity )
|
||||||
Q_PROPERTY(int waveHeight READ getWaveHeight WRITE setWaveHeight)
|
Q_PROPERTY ( int waveHeight READ getWaveHeight WRITE setWaveHeight )
|
||||||
Q_PROPERTY(int waveSpeed READ getWaveSpeed WRITE setWaveSpeed)
|
Q_PROPERTY ( int waveSpeed READ getWaveSpeed WRITE setWaveSpeed )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum WaveDirection
|
enum WaveDirection
|
||||||
@ -112,15 +113,15 @@ public:
|
|||||||
|
|
||||||
enum TextStyle
|
enum TextStyle
|
||||||
{
|
{
|
||||||
TextStyle_None = 0, /*不显示*/
|
TextStyle_None = 0, /*不显示*/
|
||||||
TextStyle_Middle_Percent = 1, /*只在中央显示百分比*/
|
TextStyle_Middle_Percent = 1, /*只在中央显示百分比*/
|
||||||
TextStyle_Percent = 2, /*只显示百分比*/
|
TextStyle_Percent = 2, /*只在下部显示百分比*/
|
||||||
TextStyle_Text = 3, /*只显示文字*/
|
TextStyle_Text = 3, /*不在下部显示百分比,只在中央显示文字*/
|
||||||
TextStyle_Percent_Text = 4, /*显示百分比和文字*/
|
TextStyle_Percent_Text = 4, /*和在下部显示百分比,和在中央显示文字*/
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit QQtCustomEffectProgressBar(QWidget* parent = 0);
|
explicit QQtCustomProgressBar ( QWidget* parent = 0 );
|
||||||
virtual ~QQtCustomEffectProgressBar();
|
virtual ~QQtCustomProgressBar();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int getMinValue() const;
|
int getMinValue() const;
|
||||||
@ -130,6 +131,7 @@ public:
|
|||||||
int getNullPosition() const;
|
int getNullPosition() const;
|
||||||
int getLineWidth() const;
|
int getLineWidth() const;
|
||||||
int getCornerRaduis() const { return cornerRadius; }
|
int getCornerRaduis() const { return cornerRadius; }
|
||||||
|
int getLineCapStyle() const { return lineCapStyle; }
|
||||||
|
|
||||||
bool getShowPercent() const;
|
bool getShowPercent() const;
|
||||||
bool getShowFree() const;
|
bool getShowFree() const;
|
||||||
@ -150,80 +152,82 @@ public:
|
|||||||
DesignStyle getDesingStyle() const { return designStyle; }
|
DesignStyle getDesingStyle() const { return designStyle; }
|
||||||
PercentStyle getPercentStyle() const;
|
PercentStyle getPercentStyle() const;
|
||||||
BackgroundType getBackgroundType() const;
|
BackgroundType getBackgroundType() const;
|
||||||
WaveDirection getWaveDirection()const { return waveDirection; }
|
WaveDirection getWaveDirection() const { return waveDirection; }
|
||||||
|
|
||||||
int getWaveDensity()const { return waveDensity; }
|
int getWaveDensity() const { return waveDensity; }
|
||||||
int getWaveHeight()const { return waveHeight; }
|
int getWaveHeight() const { return waveHeight; }
|
||||||
int getWaveSpeed()const { return waveSpeed; }
|
int getWaveSpeed() const { return waveSpeed; }
|
||||||
|
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
virtual QSize minimumSizeHint() const;
|
virtual QSize minimumSizeHint() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged(int value);
|
void valueChanged ( int value );
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/*设置范围值*/
|
/*设置范围值*/
|
||||||
void setRange(int minValue, int maxValue);
|
void setRange ( int minValue, int maxValue );
|
||||||
|
|
||||||
/*设置最大最小值*/
|
/*设置最大最小值*/
|
||||||
void setMinValue(int minValue);
|
void setMinValue ( int minValue );
|
||||||
void setMaxValue(int maxValue);
|
void setMaxValue ( int maxValue );
|
||||||
|
|
||||||
/*设置目标值*/
|
/*设置目标值*/
|
||||||
void setValue(int value);
|
void setValue ( int value );
|
||||||
|
|
||||||
/*设置最小值位置*/
|
/*设置最小值位置*/
|
||||||
void setNullPosition(int nullPosition);
|
void setNullPosition ( int nullPosition );
|
||||||
/*设置线条宽度*/
|
/*设置线条宽度*/
|
||||||
void setLineWidth(int lineWidth);
|
void setLineWidth ( int lineWidth );
|
||||||
|
/*设置线条的帽子(线头)的样式 = Qt::PenCapStyle*/
|
||||||
|
void setLineCapStyle ( int lineCapStyle );
|
||||||
|
|
||||||
/*设置是否显示百分比*/
|
/*设置是否显示百分比*/
|
||||||
void setShowPercent(bool showPercent);
|
void setShowPercent ( bool showPercent );
|
||||||
/*设置百分比后缀*/
|
/*设置百分比后缀*/
|
||||||
/*can't use default parameter*/
|
/*can't use default parameter*/
|
||||||
void setPercentSuffix(QString suffix);
|
void setPercentSuffix ( QString suffix );
|
||||||
/*设置是否显示剩余进度*/
|
/*设置是否显示剩余进度*/
|
||||||
void setShowFree(bool showFree);
|
void setShowFree ( bool showFree );
|
||||||
/*设置是否显示小圆*/
|
/*设置是否显示小圆*/
|
||||||
void setShowSmallCircle(bool showSmallCircle);
|
void setShowSmallCircle ( bool showSmallCircle );
|
||||||
/*设置进度旋转方向*/
|
/*设置进度旋转方向*/
|
||||||
void setClockWise(bool clockWise);
|
void setClockWise ( bool clockWise );
|
||||||
|
|
||||||
/*设置已使用百分比颜色*/
|
/*设置已使用百分比颜色*/
|
||||||
void setUsedColor(const QColor& usedColor);
|
void setUsedColor ( const QColor& usedColor );
|
||||||
/*设置未使用百分比颜色*/
|
/*设置未使用百分比颜色*/
|
||||||
void setFreeColor(const QColor& freeColor);
|
void setFreeColor ( const QColor& freeColor );
|
||||||
/*设置圆颜色*/
|
/*设置圆颜色*/
|
||||||
void setBackgroundColor(const QColor& backgroundColor);
|
void setBackgroundColor ( const QColor& backgroundColor );
|
||||||
/*设置圆背景图*/
|
/*设置圆背景图*/
|
||||||
void setBackgroundImage(const QString& backgroundImage);
|
void setBackgroundImage ( const QString& backgroundImage );
|
||||||
/*设置文本*/
|
/*设置文本*/
|
||||||
void setText(const QString& text);
|
void setText ( const QString& text );
|
||||||
/*设置文本颜色*/
|
/*设置文本颜色*/
|
||||||
void setTextColor(const QColor& textColor);
|
void setTextColor ( const QColor& textColor );
|
||||||
/*设置字体*/
|
/*设置字体*/
|
||||||
void setTextFont(QFont font);
|
void setTextFont ( QFont font );
|
||||||
/*设置百分比文本颜色*/
|
/*设置百分比文本颜色*/
|
||||||
void setPercentTextColor(const QColor& percentColor);
|
void setPercentTextColor ( const QColor& percentColor );
|
||||||
/*设置百分比文字字体*/
|
/*设置百分比文字字体*/
|
||||||
void setPercentTextFont(QFont percentFont);
|
void setPercentTextFont ( QFont percentFont );
|
||||||
/*设置圆角半径*/
|
/*设置圆角半径*/
|
||||||
void setCornerRadius(int cornerRadius);
|
void setCornerRadius ( int cornerRadius );
|
||||||
|
|
||||||
void setTextStyle(TextStyle textStyle);
|
void setTextStyle ( TextStyle textStyle );
|
||||||
void setDesignStyle(DesignStyle designStyle);
|
void setDesignStyle ( DesignStyle designStyle );
|
||||||
/*设置进度样式风格*/
|
/*设置进度样式风格*/
|
||||||
void setPercentStyle(PercentStyle percentStyle);
|
void setPercentStyle ( PercentStyle percentStyle );
|
||||||
void setBackgroundType(BackgroundType backgroundType);
|
void setBackgroundType ( BackgroundType backgroundType );
|
||||||
/*设置运动方向*/
|
/*设置运动方向*/
|
||||||
void setWaveDirection(WaveDirection direction);
|
void setWaveDirection ( WaveDirection direction );
|
||||||
|
|
||||||
/*设置水波密度 1-10*/
|
/*设置水波密度 1-10*/
|
||||||
void setWaveDensity(int value);
|
void setWaveDensity ( int value );
|
||||||
/*设置浪高 1-10*/
|
/*设置浪高 1-10*/
|
||||||
void setWaveHeight(int value);
|
void setWaveHeight ( int value );
|
||||||
/*设置运动速度 1-10*/
|
/*设置运动速度 1-10*/
|
||||||
void setWaveSpeed(int speed);
|
void setWaveSpeed ( int speed );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void click();
|
void click();
|
||||||
@ -231,13 +235,13 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent*);
|
virtual void paintEvent ( QPaintEvent* );
|
||||||
void drawBackground(QPainter* painter, int radius);
|
virtual void drawBackground ( QPainter* painter, int radius );
|
||||||
void drawArc(QPainter* painter, int radius);
|
virtual void drawArc ( QPainter* painter, int radius );
|
||||||
void drawPolo(QPainter* painter, int radius);
|
virtual void drawPolo ( QPainter* painter, int radius );
|
||||||
void drawWave(QPainter* painter, int radius);
|
virtual void drawWave ( QPainter* painter, int radius );
|
||||||
void drawText(QPainter* painter, int radius);
|
virtual void drawText ( QPainter* painter, int radius );
|
||||||
void drawPercentText(QPainter* painter, int radius);
|
virtual void drawPercentText ( QPainter* painter, int radius );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int maxValue; /*最小值*/
|
int maxValue; /*最小值*/
|
||||||
@ -246,6 +250,7 @@ private:
|
|||||||
|
|
||||||
int nullPosition; /*起始角度*/
|
int nullPosition; /*起始角度*/
|
||||||
int lineWidth; /*线条宽度*/
|
int lineWidth; /*线条宽度*/
|
||||||
|
int lineCapStyle; /*线条的帽子(线头)的样式*/
|
||||||
|
|
||||||
bool showPercent; /*是否显示百分比*/
|
bool showPercent; /*是否显示百分比*/
|
||||||
QString text; /*文字*/
|
QString text; /*文字*/
|
||||||
@ -280,8 +285,8 @@ private:
|
|||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
virtual void mouseReleaseEvent ( QMouseEvent* event ) override;
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent* event) override;
|
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //QQTCUSTOMEFFECTPROGRESSBAR_H
|
#endif //QQTCUSTOMPROGRESSBAR_H
|
@ -1,29 +0,0 @@
|
|||||||
#include "qqtfadeeffectwidget.h"
|
|
||||||
|
|
||||||
QQtFadeEffectWidget::QQtFadeEffectWidget(QWidget* parent) : QWidget(parent)
|
|
||||||
{
|
|
||||||
//setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
|
||||||
show_animation_ = new QPropertyAnimation(this, "opacity");
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFadeEffectWidget::beginFadeShow(quint32 param_seconds)
|
|
||||||
{
|
|
||||||
show_animation_->setDuration(param_seconds * 1000);
|
|
||||||
show_animation_->setStartValue(0);
|
|
||||||
show();
|
|
||||||
show_animation_->setEndValue(1);
|
|
||||||
show_animation_->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFadeEffectWidget::setopacity(qreal param_opacity)
|
|
||||||
{
|
|
||||||
opacity_ = param_opacity;
|
|
||||||
this->setWindowOpacity(param_opacity);
|
|
||||||
update();
|
|
||||||
emit opacityChanged(param_opacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal QQtFadeEffectWidget::getopacity()
|
|
||||||
{
|
|
||||||
return opacity_;
|
|
||||||
}
|
|
29
src/exquisite/qqtfadewidget.cpp
Normal file
29
src/exquisite/qqtfadewidget.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "qqtfadewidget.h"
|
||||||
|
|
||||||
|
QQtFadeWidget::QQtFadeWidget ( QWidget* parent ) : QWidget ( parent )
|
||||||
|
{
|
||||||
|
//setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
||||||
|
show_animation_ = new QPropertyAnimation ( this, "opacity" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFadeWidget::beginFadeShow ( quint32 param_seconds )
|
||||||
|
{
|
||||||
|
show_animation_->setDuration ( param_seconds * 1000 );
|
||||||
|
show_animation_->setStartValue ( 0 );
|
||||||
|
show();
|
||||||
|
show_animation_->setEndValue ( 1 );
|
||||||
|
show_animation_->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFadeWidget::setopacity ( qreal param_opacity )
|
||||||
|
{
|
||||||
|
opacity_ = param_opacity;
|
||||||
|
this->setWindowOpacity ( param_opacity );
|
||||||
|
update();
|
||||||
|
emit opacityChanged ( param_opacity );
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal QQtFadeWidget::getopacity()
|
||||||
|
{
|
||||||
|
return opacity_;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTFADEEFFECTWIDGET_H
|
#ifndef QQTFADEWIDGET_H
|
||||||
#define QQTFADEEFFECTWIDGET_H
|
#define QQTFADEWIDGET_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) mod 2017年10月22日17:36:59
|
* T.D.R (QQ:2657635903) mod 2017年10月22日17:36:59
|
||||||
@ -19,39 +19,39 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtFadeEffectWidget class 淡入淡出widget
|
* @brief The QQtFadeWidget class 淡入淡出效果的widget
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtFadeEffectWidget : public QWidget
|
class QQTSHARED_EXPORT QQtFadeWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(qreal opacity READ getopacity WRITE setopacity NOTIFY opacityChanged)
|
Q_PROPERTY ( qreal opacity READ getopacity WRITE setopacity NOTIFY opacityChanged )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief QQtFadeEffectWidget 构造函数
|
* @brief QQtFadeWidget 构造函数
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
explicit QQtFadeEffectWidget(QWidget* parent = 0);
|
explicit QQtFadeWidget ( QWidget* parent = 0 );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief opacityChanged 透明度改变的信号
|
* @brief opacityChanged 透明度改变的信号
|
||||||
* @param param_opacity 当前透明度
|
* @param param_opacity 当前透明度
|
||||||
*/
|
*/
|
||||||
void opacityChanged(qreal param_opacity);
|
void opacityChanged ( qreal param_opacity );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief beginFadeShow 开启淡入淡出的效果
|
* @brief beginFadeShow 开启淡入淡出的效果
|
||||||
* @param param_seconds param_seconds秒内完成效果动画
|
* @param param_seconds param_seconds秒内完成效果动画
|
||||||
*/
|
*/
|
||||||
void beginFadeShow(quint32 param_seconds);
|
void beginFadeShow ( quint32 param_seconds );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setopacity 设置透明度
|
* @brief setopacity 设置透明度
|
||||||
* @param param_opacity 透明度
|
* @param param_opacity 透明度
|
||||||
*/
|
*/
|
||||||
void setopacity(qreal param_opacity);
|
void setopacity ( qreal param_opacity );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getopacity 获取当前透明度
|
* @brief getopacity 获取当前透明度
|
||||||
@ -71,4 +71,4 @@ private:
|
|||||||
QPropertyAnimation* show_animation_;
|
QPropertyAnimation* show_animation_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTFADEEFFECTWIDGET_H
|
#endif // QQTFADEWIDGET_H
|
@ -1,96 +0,0 @@
|
|||||||
#include "qqtflipeffectstackedwidget.h"
|
|
||||||
|
|
||||||
QQtFlipEffectStackedWidget::QQtFlipEffectStackedWidget(QWidget* parent)
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent);
|
|
||||||
iRotateVal = 0;
|
|
||||||
isAnimating = false;
|
|
||||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
|
||||||
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFlipEffectStackedWidget::paintEvent(QPaintEvent* event)
|
|
||||||
{
|
|
||||||
if (isAnimating)
|
|
||||||
{
|
|
||||||
if (iRotateVal > 90)
|
|
||||||
{
|
|
||||||
QPixmap pixmap(widget(nextIndex)->size());
|
|
||||||
widget(nextIndex)->render(&pixmap);
|
|
||||||
QPainter painter(this);
|
|
||||||
|
|
||||||
QTransform transform;
|
|
||||||
transform.translate(width() / 2, 0);
|
|
||||||
transform.rotate(iRotateVal + 180, Qt::YAxis);
|
|
||||||
painter.setTransform(transform);
|
|
||||||
painter.drawPixmap(-1 * width() / 2, 0, pixmap);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QPixmap pixmap(currentWidget()->size());
|
|
||||||
currentWidget()->render(&pixmap);
|
|
||||||
QPainter painter(this);
|
|
||||||
|
|
||||||
QTransform transform;
|
|
||||||
transform.translate(width() / 2, 0);
|
|
||||||
transform.rotate(iRotateVal, Qt::YAxis);
|
|
||||||
painter.setTransform(transform);
|
|
||||||
painter.drawPixmap(-1 * width() / 2, 0, pixmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QWidget::paintEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFlipEffectStackedWidget::nextPage()
|
|
||||||
{
|
|
||||||
rotate((currentIndex() + 1) >= count() ? 0 : (currentIndex() + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFlipEffectStackedWidget::rotate(int index)
|
|
||||||
{
|
|
||||||
if (isAnimating)
|
|
||||||
return;
|
|
||||||
|
|
||||||
nextIndex = index;
|
|
||||||
int offsetx = frameRect().width();
|
|
||||||
int offsety = frameRect().height();
|
|
||||||
widget(index)->setGeometry(0, 0, offsetx, offsety);
|
|
||||||
QPropertyAnimation* animnow = new QPropertyAnimation(this, "rotateVal");
|
|
||||||
animnow->setDuration(500);
|
|
||||||
animnow->setEasingCurve(QEasingCurve::Linear);
|
|
||||||
animnow->setStartValue(0);
|
|
||||||
animnow->setEndValue(180);
|
|
||||||
connect(animnow, SIGNAL(valueChanged(QVariant)), this, SLOT(valChanged(QVariant)));
|
|
||||||
connect(animnow, SIGNAL(finished()), this, SLOT(animDone()));
|
|
||||||
currentWidget()->hide();
|
|
||||||
isAnimating = true;
|
|
||||||
animnow->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
float QQtFlipEffectStackedWidget::rotateVal()
|
|
||||||
{
|
|
||||||
return iRotateVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFlipEffectStackedWidget::setRotateVal(float fl)
|
|
||||||
{
|
|
||||||
iRotateVal = fl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFlipEffectStackedWidget::valChanged(QVariant)
|
|
||||||
{
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtFlipEffectStackedWidget::animDone()
|
|
||||||
{
|
|
||||||
iRotateVal = 0;
|
|
||||||
isAnimating = false;
|
|
||||||
widget(nextIndex)->show();
|
|
||||||
widget(nextIndex)->raise();;
|
|
||||||
setCurrentWidget(widget(nextIndex));
|
|
||||||
repaint();
|
|
||||||
}
|
|
96
src/exquisite/qqtflipstackedwidget.cpp
Normal file
96
src/exquisite/qqtflipstackedwidget.cpp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#include "qqtflipstackedwidget.h"
|
||||||
|
|
||||||
|
QQtFlipStackedWidget::QQtFlipStackedWidget ( QWidget* parent )
|
||||||
|
{
|
||||||
|
Q_UNUSED ( parent );
|
||||||
|
iRotateVal = 0;
|
||||||
|
isAnimating = false;
|
||||||
|
setAttribute ( Qt::WA_TranslucentBackground, true );
|
||||||
|
setWindowFlags ( Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFlipStackedWidget::paintEvent ( QPaintEvent* event )
|
||||||
|
{
|
||||||
|
if ( isAnimating )
|
||||||
|
{
|
||||||
|
if ( iRotateVal > 90 )
|
||||||
|
{
|
||||||
|
QPixmap pixmap ( widget ( nextIndex )->size() );
|
||||||
|
widget ( nextIndex )->render ( &pixmap );
|
||||||
|
QPainter painter ( this );
|
||||||
|
|
||||||
|
QTransform transform;
|
||||||
|
transform.translate ( width() / 2, 0 );
|
||||||
|
transform.rotate ( iRotateVal + 180, Qt::YAxis );
|
||||||
|
painter.setTransform ( transform );
|
||||||
|
painter.drawPixmap ( -1 * width() / 2, 0, pixmap );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QPixmap pixmap ( currentWidget()->size() );
|
||||||
|
currentWidget()->render ( &pixmap );
|
||||||
|
QPainter painter ( this );
|
||||||
|
|
||||||
|
QTransform transform;
|
||||||
|
transform.translate ( width() / 2, 0 );
|
||||||
|
transform.rotate ( iRotateVal, Qt::YAxis );
|
||||||
|
painter.setTransform ( transform );
|
||||||
|
painter.drawPixmap ( -1 * width() / 2, 0, pixmap );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QWidget::paintEvent ( event );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFlipStackedWidget::nextPage()
|
||||||
|
{
|
||||||
|
rotate ( ( currentIndex() + 1 ) >= count() ? 0 : ( currentIndex() + 1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFlipStackedWidget::rotate ( int index )
|
||||||
|
{
|
||||||
|
if ( isAnimating )
|
||||||
|
return;
|
||||||
|
|
||||||
|
nextIndex = index;
|
||||||
|
int offsetx = frameRect().width();
|
||||||
|
int offsety = frameRect().height();
|
||||||
|
widget ( index )->setGeometry ( 0, 0, offsetx, offsety );
|
||||||
|
QPropertyAnimation* animnow = new QPropertyAnimation ( this, "rotateVal" );
|
||||||
|
animnow->setDuration ( 500 );
|
||||||
|
animnow->setEasingCurve ( QEasingCurve::Linear );
|
||||||
|
animnow->setStartValue ( 0 );
|
||||||
|
animnow->setEndValue ( 180 );
|
||||||
|
connect ( animnow, SIGNAL ( valueChanged ( QVariant ) ), this, SLOT ( valChanged ( QVariant ) ) );
|
||||||
|
connect ( animnow, SIGNAL ( finished() ), this, SLOT ( animDone() ) );
|
||||||
|
currentWidget()->hide();
|
||||||
|
isAnimating = true;
|
||||||
|
animnow->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
float QQtFlipStackedWidget::rotateVal()
|
||||||
|
{
|
||||||
|
return iRotateVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFlipStackedWidget::setRotateVal ( float fl )
|
||||||
|
{
|
||||||
|
iRotateVal = fl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFlipStackedWidget::valChanged ( QVariant )
|
||||||
|
{
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtFlipStackedWidget::animDone()
|
||||||
|
{
|
||||||
|
iRotateVal = 0;
|
||||||
|
isAnimating = false;
|
||||||
|
widget ( nextIndex )->show();
|
||||||
|
widget ( nextIndex )->raise();;
|
||||||
|
setCurrentWidget ( widget ( nextIndex ) );
|
||||||
|
repaint();
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTFLIPEFFECTSTACKEDWIDGET_H
|
#ifndef QQTFLIPSTACKEDWIDGET_H
|
||||||
#define QQTFLIPEFFECTSTACKEDWIDGET_H
|
#define QQTFLIPSTACKEDWIDGET_H
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) 2017年10月22日15:31:26
|
* T.D.R (QQ:2657635903) 2017年10月22日15:31:26
|
||||||
* MOD
|
* MOD
|
||||||
@ -23,23 +23,23 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtFlipEffectStackedWidget class 反转的stacked
|
* @brief The QQtFlipStackedWidget class 反转效果的stacked
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtFlipEffectStackedWidget : public QStackedWidget
|
class QQTSHARED_EXPORT QQtFlipStackedWidget : public QStackedWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float rotateVal READ rotateVal WRITE setRotateVal)
|
Q_PROPERTY ( float rotateVal READ rotateVal WRITE setRotateVal )
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief NBaseRotatingStackedWidget 构造函数
|
* @brief NBaseRotatingStackedWidget 构造函数
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
explicit QQtFlipEffectStackedWidget(QWidget* parent = 0);
|
explicit QQtFlipStackedWidget ( QWidget* parent = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief paintEvent 绘制事件
|
* @brief paintEvent 绘制事件
|
||||||
*/
|
*/
|
||||||
void paintEvent(QPaintEvent* event);
|
void paintEvent ( QPaintEvent* event );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief rotate index 跳转到索引页
|
* @brief rotate index 跳转到索引页
|
||||||
*/
|
*/
|
||||||
void rotate(int index);
|
void rotate ( int index );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief rotateVal 旋转值
|
* @brief rotateVal 旋转值
|
||||||
@ -64,13 +64,13 @@ public:
|
|||||||
* @brief setRotateVal 设置旋转值
|
* @brief setRotateVal 设置旋转值
|
||||||
* @param fl 值
|
* @param fl 值
|
||||||
*/
|
*/
|
||||||
void setRotateVal(float fl);
|
void setRotateVal ( float fl );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/**
|
/**
|
||||||
* @brief valChanged 旋转值改变了
|
* @brief valChanged 旋转值改变了
|
||||||
*/
|
*/
|
||||||
void valChanged(QVariant);
|
void valChanged ( QVariant );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief animDone 动画结束
|
* @brief animDone 动画结束
|
||||||
@ -94,4 +94,4 @@ private:
|
|||||||
int nextIndex;
|
int nextIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTFLIPEFFECTSTACKEDWIDGET_H
|
#endif // QQTFLIPSTACKEDWIDGET_H
|
@ -1,16 +0,0 @@
|
|||||||
#include "qqthorizontaltexteffecttabwidget.h"
|
|
||||||
|
|
||||||
QQtHorizontalTextEffectTabWidget::QQtHorizontalTextEffectTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
|
||||||
{
|
|
||||||
m_bar = new QQtHorizontalTextEffectTabBar(this);
|
|
||||||
setTabBar(m_bar);
|
|
||||||
/*
|
|
||||||
* pline() << "这是我设置的bar:" << bar;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtHorizontalTextEffectTabWidget::setObjectName(const QString& name)
|
|
||||||
{
|
|
||||||
m_bar->setObjectName(QString("%1_bar").arg(name));
|
|
||||||
return QQtTabWidget::setObjectName(name);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#ifndef QQTHORIZONTALTEXTEFFECTTABWIDGET_H
|
|
||||||
#define QQTHORIZONTALTEXTEFFECTTABWIDGET_H
|
|
||||||
|
|
||||||
#include <qqttabwidget.h>
|
|
||||||
#include <qqthorizontaltexteffecttabbar.h>
|
|
||||||
|
|
||||||
class QQtHorizontalTextEffectTabWidget : public QQtTabWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QQtHorizontalTextEffectTabWidget(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private:
|
|
||||||
QQtHorizontalTextEffectTabBar* m_bar;
|
|
||||||
|
|
||||||
// QQtTabWidget interface
|
|
||||||
public:
|
|
||||||
virtual void setObjectName(const QString& name) override;
|
|
||||||
virtual QQtTabBar* localTabBar() const override { return m_bar; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QQTHORIZONTALTEXTEFFECTTABWIDGET_H
|
|
@ -1,4 +1,4 @@
|
|||||||
#include "qqthorizontaltexteffecttabbar.h"
|
#include "qqthorizontaltexttabbar.h"
|
||||||
#include "QStylePainter"
|
#include "QStylePainter"
|
||||||
#include "QStyleOptionTabV3"
|
#include "QStyleOptionTabV3"
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
@ -7,20 +7,20 @@
|
|||||||
#include "QToolButton"
|
#include "QToolButton"
|
||||||
#include "qqtcore.h"
|
#include "qqtcore.h"
|
||||||
|
|
||||||
QQtHorizontalTextEffectTabBar::QQtHorizontalTextEffectTabBar(QWidget* parent) :
|
QQtHorizontalTextTabBar::QQtHorizontalTextTabBar ( QWidget* parent ) :
|
||||||
QQtTabBar(parent)
|
QQtTabBar ( parent )
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy ( Qt::NoFocus );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtHorizontalTextEffectTabBar::paintEvent(QPaintEvent* e)
|
void QQtHorizontalTextTabBar::paintEvent ( QPaintEvent* e )
|
||||||
{
|
{
|
||||||
Q_UNUSED(e)
|
Q_UNUSED ( e )
|
||||||
|
|
||||||
QStyleOptionTabBarBase optTabBase;
|
QStyleOptionTabBarBase optTabBase;
|
||||||
initStyleBaseOption(&optTabBase, this, size());
|
initStyleBaseOption ( &optTabBase, this, size() );
|
||||||
|
|
||||||
QStylePainter p(this);
|
QStylePainter p ( this );
|
||||||
int selected = -1;
|
int selected = -1;
|
||||||
int cutLeft = -1;
|
int cutLeft = -1;
|
||||||
int cutRight = -1;
|
int cutRight = -1;
|
||||||
@ -37,18 +37,18 @@ void QQtHorizontalTextEffectTabBar::paintEvent(QPaintEvent* e)
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i)
|
for ( int i = 0; i < count(); ++i )
|
||||||
optTabBase.tabBarRect |= tabRect(i);
|
optTabBase.tabBarRect |= tabRect ( i );
|
||||||
|
|
||||||
optTabBase.selectedTabRect = tabRect(selected);
|
optTabBase.selectedTabRect = tabRect ( selected );
|
||||||
|
|
||||||
if (drawBase())
|
if ( drawBase() )
|
||||||
p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase);
|
p.drawPrimitive ( QStyle::PE_FrameTabBarBase, optTabBase );
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i)
|
for ( int i = 0; i < count(); ++i )
|
||||||
{
|
{
|
||||||
QStyleOptionTab tab;
|
QStyleOptionTab tab;
|
||||||
initStyleOption(&tab, i);
|
initStyleOption ( &tab, i );
|
||||||
|
|
||||||
//drag and drop ignore
|
//drag and drop ignore
|
||||||
// if (d->paintWithOffsets && d->tabList[i].dragOffset != 0)
|
// if (d->paintWithOffsets && d->tabList[i].dragOffset != 0)
|
||||||
@ -63,37 +63,37 @@ void QQtHorizontalTextEffectTabBar::paintEvent(QPaintEvent* e)
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!(tab.state & QStyle::State_Enabled))
|
if ( ! ( tab.state & QStyle::State_Enabled ) )
|
||||||
{
|
{
|
||||||
tab.palette.setCurrentColorGroup(QPalette::Disabled);
|
tab.palette.setCurrentColorGroup ( QPalette::Disabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this tab is partially obscured, make a note of it so that we can pass the information
|
// If this tab is partially obscured, make a note of it so that we can pass the information
|
||||||
// along when we draw the tear.
|
// along when we draw the tear.
|
||||||
QRect tabRect = this->tabRect(i);
|
QRect tabRect = this->tabRect ( i );
|
||||||
int tabStart = vertical ? tabRect.top() : tabRect.left();
|
int tabStart = vertical ? tabRect.top() : tabRect.left();
|
||||||
int tabEnd = vertical ? tabRect.bottom() : tabRect.right();
|
int tabEnd = vertical ? tabRect.bottom() : tabRect.right();
|
||||||
|
|
||||||
// Don't bother drawing a tab if the entire tab is outside of the visible tab bar.
|
// Don't bother drawing a tab if the entire tab is outside of the visible tab bar.
|
||||||
if ((!vertical && (tab.rect.right() < 0 || tab.rect.left() > width()))
|
if ( ( !vertical && ( tab.rect.right() < 0 || tab.rect.left() > width() ) )
|
||||||
|| (vertical && (tab.rect.bottom() < 0 || tab.rect.top() > height())))
|
|| ( vertical && ( tab.rect.bottom() < 0 || tab.rect.top() > height() ) ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
optTabBase.tabBarRect |= tab.rect;
|
optTabBase.tabBarRect |= tab.rect;
|
||||||
|
|
||||||
if (i == selected)
|
if ( i == selected )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
setShape(QTabBar::RoundedNorth);
|
setShape ( QTabBar::RoundedNorth );
|
||||||
p.drawControl(QStyle::CE_TabBarTab, tab);
|
p.drawControl ( QStyle::CE_TabBarTab, tab );
|
||||||
setShape(QTabBar::RoundedWest);
|
setShape ( QTabBar::RoundedWest );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the selected tab last to get it "on top"
|
// Draw the selected tab last to get it "on top"
|
||||||
if (selected >= 0)
|
if ( selected >= 0 )
|
||||||
{
|
{
|
||||||
QStyleOptionTab tab;
|
QStyleOptionTab tab;
|
||||||
initStyleOption(&tab, selected);
|
initStyleOption ( &tab, selected );
|
||||||
//ignore
|
//ignore
|
||||||
// if (d->paintWithOffsets && d->tabList[selected].dragOffset != 0)
|
// if (d->paintWithOffsets && d->tabList[selected].dragOffset != 0)
|
||||||
// {
|
// {
|
||||||
@ -102,14 +102,14 @@ void QQtHorizontalTextEffectTabBar::paintEvent(QPaintEvent* e)
|
|||||||
// else
|
// else
|
||||||
// tab.rect.moveLeft(tab.rect.x() + d->tabList[selected].dragOffset);
|
// tab.rect.moveLeft(tab.rect.x() + d->tabList[selected].dragOffset);
|
||||||
// }
|
// }
|
||||||
setShape(QTabBar::RoundedNorth);
|
setShape ( QTabBar::RoundedNorth );
|
||||||
p.drawControl(QStyle::CE_TabBarTab, tab);
|
p.drawControl ( QStyle::CE_TabBarTab, tab );
|
||||||
setShape(QTabBar::RoundedWest);
|
setShape ( QTabBar::RoundedWest );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtHorizontalTextEffectTabBar::drawTextLabel(QPainter* p)
|
void QQtHorizontalTextTabBar::drawTextLabel ( QPainter* p )
|
||||||
{
|
{
|
||||||
// for (int i = 0; i < count(); ++i)
|
// for (int i = 0; i < count(); ++i)
|
||||||
// {
|
// {
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTHORIZONTALTEXTEFFECTTABBAR_H
|
#ifndef QQTHORIZONTALTEXTTABBAR_H
|
||||||
#define QQTHORIZONTALTEXTEFFECTTABBAR_H
|
#define QQTHORIZONTALTEXTTABBAR_H
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include "qqtcore.h"
|
#include "qqtcore.h"
|
||||||
@ -8,24 +8,24 @@
|
|||||||
#include <qqttabbar.h>
|
#include <qqttabbar.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtHorizontalTextEffectTabBar class
|
* @brief The QQtHorizontalTextTabBar class
|
||||||
* Qt tabbar竖排文字也是竖着的,QQt改成横的。
|
* Qt tabbar竖排文字也是竖着的,QQt改成横的。
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtHorizontalTextEffectTabBar : public QQtTabBar
|
class QQTSHARED_EXPORT QQtHorizontalTextTabBar : public QQtTabBar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QQtHorizontalTextEffectTabBar(QWidget* parent = 0);
|
explicit QQtHorizontalTextTabBar ( QWidget* parent = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent*);
|
virtual void paintEvent ( QPaintEvent* );
|
||||||
virtual void drawTextLabel(QPainter* p);
|
virtual void drawTextLabel ( QPainter* p );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void initStyleBaseOption(QStyleOptionTabBarBase* optTabBase, QTabBar* tabbar, QSize size) {
|
static void initStyleBaseOption ( QStyleOptionTabBarBase* optTabBase, QTabBar* tabbar, QSize size ) {
|
||||||
// QStyleOptionTab tabOverlap;
|
// QStyleOptionTab tabOverlap;
|
||||||
// tabOverlap.shape = tabbar->shape();
|
// tabOverlap.shape = tabbar->shape();
|
||||||
// int overlap = tabbar->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, &tabOverlap, tabbar);
|
// int overlap = tabbar->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, &tabOverlap, tabbar);
|
||||||
@ -60,4 +60,4 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTHORIZONTALTEXTEFFECTTABBAR_H
|
#endif // QQTHORIZONTALTEXTTABBAR_H
|
16
src/exquisite/qqthorizontaltexttabwidget.cpp
Normal file
16
src/exquisite/qqthorizontaltexttabwidget.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "qqthorizontaltexttabwidget.h"
|
||||||
|
|
||||||
|
QQtHorizontalTextTabWidget::QQtHorizontalTextTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
||||||
|
{
|
||||||
|
m_bar = new QQtHorizontalTextTabBar(this);
|
||||||
|
setTabBar(m_bar);
|
||||||
|
/*
|
||||||
|
* pline() << "这是我设置的bar:" << bar;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtHorizontalTextTabWidget::setObjectName(const QString& name)
|
||||||
|
{
|
||||||
|
m_bar->setObjectName(QString("%1_bar").arg(name));
|
||||||
|
return QQtTabWidget::setObjectName(name);
|
||||||
|
}
|
26
src/exquisite/qqthorizontaltexttabwidget.h
Normal file
26
src/exquisite/qqthorizontaltexttabwidget.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef QQTHORIZONTALTEXTTABWIDGET_H
|
||||||
|
#define QQTHORIZONTALTEXTTABWIDGET_H
|
||||||
|
|
||||||
|
#include <qqttabwidget.h>
|
||||||
|
#include <qqthorizontaltexttabbar.h>
|
||||||
|
|
||||||
|
class QQtHorizontalTextTabWidget : public QQtTabWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtHorizontalTextTabWidget ( QWidget* parent = nullptr );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QQtHorizontalTextTabBar* m_bar;
|
||||||
|
|
||||||
|
// QQtTabWidget interface
|
||||||
|
public:
|
||||||
|
virtual void setObjectName ( const QString& name ) override;
|
||||||
|
virtual QQtTabBar* localTabBar() const override { return m_bar; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTHORIZONTALTEXTTABWIDGET_H
|
@ -1,6 +1,6 @@
|
|||||||
#include "qqtledbannereffectlabel.h"
|
#include "qqtledbannerlabel.h"
|
||||||
|
|
||||||
QQtLedBannerEffectLabel::QQtLedBannerEffectLabel(QWidget* parent) : QLabel(parent)
|
QQtLedBannerLabel::QQtLedBannerLabel(QWidget* parent) : QLabel(parent)
|
||||||
{
|
{
|
||||||
textCol = Qt::green;
|
textCol = Qt::green;
|
||||||
backCol = Qt::black;
|
backCol = Qt::black;
|
||||||
@ -16,7 +16,7 @@ QQtLedBannerEffectLabel::QQtLedBannerEffectLabel(QWidget* parent) : QLabel(paren
|
|||||||
timerState = false;
|
timerState = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::paintEvent(QPaintEvent* event)
|
void QQtLedBannerLabel::paintEvent(QPaintEvent* event)
|
||||||
{
|
{
|
||||||
paintBorder();
|
paintBorder();
|
||||||
paintText();
|
paintText();
|
||||||
@ -24,7 +24,7 @@ void QQtLedBannerEffectLabel::paintEvent(QPaintEvent* event)
|
|||||||
QLabel::paintEvent(event);
|
QLabel::paintEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::paintBorder()
|
void QQtLedBannerLabel::paintBorder()
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setWindow(0, 0, length, 14);
|
painter.setWindow(0, 0, length, 14);
|
||||||
@ -36,7 +36,7 @@ void QQtLedBannerEffectLabel::paintBorder()
|
|||||||
painter.drawRect(border);
|
painter.drawRect(border);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::paintText()
|
void QQtLedBannerLabel::paintText()
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setWindow(0, 0, length, 14);
|
painter.setWindow(0, 0, length, 14);
|
||||||
@ -51,7 +51,7 @@ void QQtLedBannerEffectLabel::paintText()
|
|||||||
emit timeOut();
|
emit timeOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::paintGrid()
|
void QQtLedBannerLabel::paintGrid()
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setWindow(0, 0, length, 14);
|
painter.setWindow(0, 0, length, 14);
|
||||||
@ -69,7 +69,7 @@ void QQtLedBannerEffectLabel::paintGrid()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::timerEvent(QTimerEvent* event)
|
void QQtLedBannerLabel::timerEvent(QTimerEvent* event)
|
||||||
{
|
{
|
||||||
if (timerState == true)
|
if (timerState == true)
|
||||||
{
|
{
|
||||||
@ -110,26 +110,26 @@ void QQtLedBannerEffectLabel::timerEvent(QTimerEvent* event)
|
|||||||
QLabel::timerEvent(event);
|
QLabel::timerEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::setTextColor(QColor colorTx)
|
void QQtLedBannerLabel::setTextColor(QColor colorTx)
|
||||||
{
|
{
|
||||||
textCol = colorTx;
|
textCol = colorTx;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::setBackgroundColor(QColor colorBg)
|
void QQtLedBannerLabel::setBackgroundColor(QColor colorBg)
|
||||||
{
|
{
|
||||||
backCol = colorBg;
|
backCol = colorBg;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::setEffect(Effect effect)
|
void QQtLedBannerLabel::setEffect(Effect effect)
|
||||||
{
|
{
|
||||||
typeEff = effect;
|
typeEff = effect;
|
||||||
textMsg = textOn;
|
textMsg = textOn;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::setText(QString text)
|
void QQtLedBannerLabel::setText(QString text)
|
||||||
{
|
{
|
||||||
textMsg = text;
|
textMsg = text;
|
||||||
textOn = text;
|
textOn = text;
|
||||||
@ -139,7 +139,7 @@ void QQtLedBannerEffectLabel::setText(QString text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::setTimer(int timer)
|
void QQtLedBannerLabel::setTimer(int timer)
|
||||||
{
|
{
|
||||||
killTimer(idTimer);
|
killTimer(idTimer);
|
||||||
timerVal = timer;
|
timerVal = timer;
|
||||||
@ -147,7 +147,7 @@ void QQtLedBannerEffectLabel::setTimer(int timer)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtLedBannerEffectLabel::startEffect(bool start)
|
void QQtLedBannerLabel::startEffect(bool start)
|
||||||
{
|
{
|
||||||
timerState = start;
|
timerState = start;
|
||||||
|
|
||||||
@ -164,42 +164,42 @@ void QQtLedBannerEffectLabel::startEffect(bool start)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize QQtLedBannerEffectLabel::minimumSizeHint() const
|
QSize QQtLedBannerLabel::minimumSizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(length * 0.3, 3);
|
return QSize(length * 0.3, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize QQtLedBannerEffectLabel::sizeHint() const
|
QSize QQtLedBannerLabel::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(length * 3, 30);
|
return QSize(length * 3, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtLedBannerEffectLabel::Effect QQtLedBannerEffectLabel::effect() const
|
QQtLedBannerLabel::Effect QQtLedBannerLabel::effect() const
|
||||||
{
|
{
|
||||||
return typeEff;
|
return typeEff;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QQtLedBannerEffectLabel::colorText() const
|
QColor QQtLedBannerLabel::colorText() const
|
||||||
{
|
{
|
||||||
return textCol;
|
return textCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QQtLedBannerEffectLabel::colorBackground() const
|
QColor QQtLedBannerLabel::colorBackground() const
|
||||||
{
|
{
|
||||||
return backCol;
|
return backCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QQtLedBannerEffectLabel::text() const
|
QString QQtLedBannerLabel::text() const
|
||||||
{
|
{
|
||||||
return textOn;
|
return textOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtLedBannerEffectLabel::timerInterval() const
|
int QQtLedBannerLabel::timerInterval() const
|
||||||
{
|
{
|
||||||
return timerVal;
|
return timerVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtLedBannerEffectLabel::isStart() const
|
bool QQtLedBannerLabel::isStart() const
|
||||||
{
|
{
|
||||||
return timerState;
|
return timerState;
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTLEDBANNEREFFECTLABEL_H
|
#ifndef QQTLEDBANNERLABEL_H
|
||||||
#define QQTLEDBANNEREFFECTLABEL_H
|
#define QQTLEDBANNERLABEL_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) 2017年10月22日15:31:26
|
* T.D.R (QQ:2657635903) 2017年10月22日15:31:26
|
||||||
@ -18,21 +18,21 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtLedBannerEffectLabel class 仿LED效果的widget
|
* @brief The QQtLedBannerLabel class 仿LED效果的widget
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtLedBannerEffectLabel : public QLabel
|
class QQTSHARED_EXPORT QQtLedBannerLabel : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(Effect)
|
Q_ENUMS ( Effect )
|
||||||
Q_PROPERTY(Effect effect READ effect WRITE setEffect)
|
Q_PROPERTY ( Effect effect READ effect WRITE setEffect )
|
||||||
Q_PROPERTY(QColor colorText READ colorText WRITE setTextColor)
|
Q_PROPERTY ( QColor colorText READ colorText WRITE setTextColor )
|
||||||
Q_PROPERTY(QColor colorBackground READ colorBackground WRITE setBackgroundColor)
|
Q_PROPERTY ( QColor colorBackground READ colorBackground WRITE setBackgroundColor )
|
||||||
Q_PROPERTY(QString text READ text WRITE setText)
|
Q_PROPERTY ( QString text READ text WRITE setText )
|
||||||
Q_PROPERTY(int timer READ timerInterval WRITE setTimer)
|
Q_PROPERTY ( int timer READ timerInterval WRITE setTimer )
|
||||||
Q_PROPERTY(bool start READ isStart WRITE startEffect)
|
Q_PROPERTY ( bool start READ isStart WRITE startEffect )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QQtLedBannerEffectLabel(QWidget* parent = 0);
|
explicit QQtLedBannerLabel ( QWidget* parent = 0 );
|
||||||
/**
|
/**
|
||||||
* @brief The Effect enum 特效枚举
|
* @brief The Effect enum 特效枚举
|
||||||
* sliding 为跑马灯效果
|
* sliding 为跑马灯效果
|
||||||
@ -49,37 +49,37 @@ public slots:
|
|||||||
* @brief setTextColor 设置文本颜色
|
* @brief setTextColor 设置文本颜色
|
||||||
* @param colorTx 颜色
|
* @param colorTx 颜色
|
||||||
*/
|
*/
|
||||||
void setTextColor(QColor colorText);
|
void setTextColor ( QColor colorText );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setBackgroundColor 设置背景颜色
|
* @brief setBackgroundColor 设置背景颜色
|
||||||
* @param colorBg 颜色
|
* @param colorBg 颜色
|
||||||
*/
|
*/
|
||||||
void setBackgroundColor(QColor colorBackground);
|
void setBackgroundColor ( QColor colorBackground );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setEffect 设置特效类型
|
* @brief setEffect 设置特效类型
|
||||||
* @param effect sliding-为跑马灯效果 intermittent-为闪烁效果
|
* @param effect sliding-为跑马灯效果 intermittent-为闪烁效果
|
||||||
*/
|
*/
|
||||||
void setEffect(Effect effect);
|
void setEffect ( Effect effect );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setText 设置文本内容
|
* @brief setText 设置文本内容
|
||||||
* @param text 文本
|
* @param text 文本
|
||||||
*/
|
*/
|
||||||
void setText(QString text);
|
void setText ( QString text );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setTimer 设置定时频率(毫秒)
|
* @brief setTimer 设置定时频率(毫秒)
|
||||||
* @param timer 频率
|
* @param timer 频率
|
||||||
*/
|
*/
|
||||||
void setTimer(int timer);
|
void setTimer ( int timer );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief startEffect 开始/关闭 特效
|
* @brief startEffect 开始/关闭 特效
|
||||||
* @param start true-开启 false-关闭
|
* @param start true-开启 false-关闭
|
||||||
*/
|
*/
|
||||||
void startEffect(bool start);
|
void startEffect ( bool start );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -138,13 +138,13 @@ protected:
|
|||||||
* @brief paintEvent 绘制事件
|
* @brief paintEvent 绘制事件
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
void paintEvent(QPaintEvent* event);
|
void paintEvent ( QPaintEvent* event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief timerEvent 定时器事件
|
* @brief timerEvent 定时器事件
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
void timerEvent(QTimerEvent* event);
|
void timerEvent ( QTimerEvent* event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief paintBorder 绘制边框
|
* @brief paintBorder 绘制边框
|
||||||
@ -176,4 +176,4 @@ private:
|
|||||||
Effect typeEff;
|
Effect typeEff;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTLEDBANNEREFFECTLABEL_H
|
#endif // QQTLEDBANNERLABEL_H
|
@ -1,79 +0,0 @@
|
|||||||
#ifndef QQTMARQUEEEFFECTLABEL_H
|
|
||||||
#define QQTMARQUEEEFFECTLABEL_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* T.D.R (QQ:2657635903) 2017年10月22日17:24:27
|
|
||||||
* MOD
|
|
||||||
**/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 作者: daodaoliang
|
|
||||||
* 时间: 2016年8月11日
|
|
||||||
* 邮箱: daodaoliang@yeah.net
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QUrl>
|
|
||||||
#include <QResizeEvent>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include "qqt-local.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The QQtMarqueeEffectLabel class 跑马灯组件
|
|
||||||
*/
|
|
||||||
class QQTSHARED_EXPORT QQtMarqueeEffectLabel : public QLabel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_ENUMS(Direction)
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief The Direction enum 文字的浮动方向
|
|
||||||
*/
|
|
||||||
enum Direction
|
|
||||||
{
|
|
||||||
// 从右向左
|
|
||||||
RightToLeft = 0,
|
|
||||||
// 从下到上
|
|
||||||
BottomToTop = 1
|
|
||||||
};
|
|
||||||
public:
|
|
||||||
QQtMarqueeEffectLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
|
||||||
QQtMarqueeEffectLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
|
||||||
virtual ~QQtMarqueeEffectLabel();
|
|
||||||
int interval() const;
|
|
||||||
bool isActive() const;
|
|
||||||
Direction direction() const;
|
|
||||||
void setAlignment(Qt::Alignment align);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void intervalChanged(int mInterval);
|
|
||||||
void activeChanged(bool active);
|
|
||||||
void directionChanged(Direction direction);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void reset();
|
|
||||||
void setActive(bool active);
|
|
||||||
void setInterval(int msec);
|
|
||||||
void start();
|
|
||||||
void stop();
|
|
||||||
void setDirection(Direction param_direciton);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void enterEvent(QEvent* event);
|
|
||||||
virtual void leaveEvent(QEvent* event);
|
|
||||||
virtual void resizeEvent(QResizeEvent* event);
|
|
||||||
virtual void timerEvent(QTimerEvent* event);
|
|
||||||
virtual void paintEvent(QPaintEvent* event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int marqueeMargin;
|
|
||||||
int timerId;
|
|
||||||
int mInterval;
|
|
||||||
bool active;
|
|
||||||
bool mouseIn;
|
|
||||||
Direction mDirection;
|
|
||||||
};
|
|
||||||
#endif // QQTMARQUEEEFFECTLABEL_H
|
|
@ -1,18 +1,18 @@
|
|||||||
#include "qqtmarqueeeffectlabel.h"
|
#include "qqtmarqueelabel.h"
|
||||||
|
|
||||||
QQtMarqueeEffectLabel::QQtMarqueeEffectLabel(QWidget* parent, Qt::WindowFlags f)
|
QQtMarqueeLabel::QQtMarqueeLabel(QWidget* parent, Qt::WindowFlags f)
|
||||||
: QLabel(parent, f)
|
: QLabel(parent, f)
|
||||||
{
|
{
|
||||||
marqueeMargin = 0;
|
marqueeMargin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtMarqueeEffectLabel::QQtMarqueeEffectLabel(const QString& text, QWidget* parent, Qt::WindowFlags f)
|
QQtMarqueeLabel::QQtMarqueeLabel(const QString& text, QWidget* parent, Qt::WindowFlags f)
|
||||||
: QLabel(text, parent, f)
|
: QLabel(text, parent, f)
|
||||||
{
|
{
|
||||||
marqueeMargin = 0;
|
marqueeMargin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtMarqueeEffectLabel::~QQtMarqueeEffectLabel()
|
QQtMarqueeLabel::~QQtMarqueeLabel()
|
||||||
{
|
{
|
||||||
if (timerId > 0)
|
if (timerId > 0)
|
||||||
{
|
{
|
||||||
@ -21,22 +21,22 @@ QQtMarqueeEffectLabel::~QQtMarqueeEffectLabel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtMarqueeEffectLabel::interval() const
|
int QQtMarqueeLabel::interval() const
|
||||||
{
|
{
|
||||||
return mInterval;
|
return mInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QQtMarqueeEffectLabel::isActive() const
|
bool QQtMarqueeLabel::isActive() const
|
||||||
{
|
{
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtMarqueeEffectLabel::Direction QQtMarqueeEffectLabel::direction() const
|
QQtMarqueeLabel::Direction QQtMarqueeLabel::direction() const
|
||||||
{
|
{
|
||||||
return mDirection;
|
return mDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::setAlignment(Qt::Alignment align)
|
void QQtMarqueeLabel::setAlignment(Qt::Alignment align)
|
||||||
{
|
{
|
||||||
switch (mDirection)
|
switch (mDirection)
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ void QQtMarqueeEffectLabel::setAlignment(Qt::Alignment align)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::reset()
|
void QQtMarqueeLabel::reset()
|
||||||
{
|
{
|
||||||
if (timerId != 0)
|
if (timerId != 0)
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@ void QQtMarqueeEffectLabel::reset()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::setActive(bool active)
|
void QQtMarqueeLabel::setActive(bool active)
|
||||||
{
|
{
|
||||||
if (this->active == active)
|
if (this->active == active)
|
||||||
{
|
{
|
||||||
@ -95,7 +95,7 @@ void QQtMarqueeEffectLabel::setActive(bool active)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::setInterval(int msec)
|
void QQtMarqueeLabel::setInterval(int msec)
|
||||||
{
|
{
|
||||||
if (msec < 1)
|
if (msec < 1)
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ void QQtMarqueeEffectLabel::setInterval(int msec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::start()
|
void QQtMarqueeLabel::start()
|
||||||
{
|
{
|
||||||
bool bActiveChanged = false;
|
bool bActiveChanged = false;
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void QQtMarqueeEffectLabel::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::stop()
|
void QQtMarqueeLabel::stop()
|
||||||
{
|
{
|
||||||
bool bActiveChanged = false;
|
bool bActiveChanged = false;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void QQtMarqueeEffectLabel::stop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::setDirection(QQtMarqueeEffectLabel::Direction param_direciton)
|
void QQtMarqueeLabel::setDirection(QQtMarqueeLabel::Direction param_direciton)
|
||||||
{
|
{
|
||||||
if (param_direciton == mDirection)
|
if (param_direciton == mDirection)
|
||||||
{
|
{
|
||||||
@ -206,7 +206,7 @@ void QQtMarqueeEffectLabel::setDirection(QQtMarqueeEffectLabel::Direction param_
|
|||||||
Q_EMIT directionChanged(mDirection);
|
Q_EMIT directionChanged(mDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::enterEvent(QEvent* event)
|
void QQtMarqueeLabel::enterEvent(QEvent* event)
|
||||||
{
|
{
|
||||||
mouseIn = true;
|
mouseIn = true;
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ void QQtMarqueeEffectLabel::enterEvent(QEvent* event)
|
|||||||
QLabel::enterEvent(event);
|
QLabel::enterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::leaveEvent(QEvent* event)
|
void QQtMarqueeLabel::leaveEvent(QEvent* event)
|
||||||
{
|
{
|
||||||
mouseIn = false;
|
mouseIn = false;
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ void QQtMarqueeEffectLabel::leaveEvent(QEvent* event)
|
|||||||
QLabel::leaveEvent(event);
|
QLabel::leaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::resizeEvent(QResizeEvent* event)
|
void QQtMarqueeLabel::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
QLabel::resizeEvent(event);
|
QLabel::resizeEvent(event);
|
||||||
int w;
|
int w;
|
||||||
@ -273,7 +273,7 @@ void QQtMarqueeEffectLabel::resizeEvent(QResizeEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::timerEvent(QTimerEvent* event)
|
void QQtMarqueeLabel::timerEvent(QTimerEvent* event)
|
||||||
{
|
{
|
||||||
QLabel::timerEvent(event);
|
QLabel::timerEvent(event);
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ void QQtMarqueeEffectLabel::timerEvent(QTimerEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMarqueeEffectLabel::paintEvent(QPaintEvent* event)
|
void QQtMarqueeLabel::paintEvent(QPaintEvent* event)
|
||||||
{
|
{
|
||||||
switch (mDirection)
|
switch (mDirection)
|
||||||
{
|
{
|
79
src/exquisite/qqtmarqueelabel.h
Normal file
79
src/exquisite/qqtmarqueelabel.h
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#ifndef QQTMARQUEELABEL_H
|
||||||
|
#define QQTMARQUEELABEL_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* T.D.R (QQ:2657635903) 2017年10月22日17:24:27
|
||||||
|
* MOD
|
||||||
|
**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作者: daodaoliang
|
||||||
|
* 时间: 2016年8月11日
|
||||||
|
* 邮箱: daodaoliang@yeah.net
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include "qqt-local.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The QQtMarqueeLabel class 跑马灯组件
|
||||||
|
*/
|
||||||
|
class QQTSHARED_EXPORT QQtMarqueeLabel : public QLabel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_ENUMS ( Direction )
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief The Direction enum 文字的浮动方向
|
||||||
|
*/
|
||||||
|
enum Direction
|
||||||
|
{
|
||||||
|
// 从右向左
|
||||||
|
RightToLeft = 0,
|
||||||
|
// 从下到上
|
||||||
|
BottomToTop = 1
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
QQtMarqueeLabel ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
|
QQtMarqueeLabel ( const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
|
virtual ~QQtMarqueeLabel();
|
||||||
|
int interval() const;
|
||||||
|
bool isActive() const;
|
||||||
|
Direction direction() const;
|
||||||
|
void setAlignment ( Qt::Alignment align );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void intervalChanged ( int mInterval );
|
||||||
|
void activeChanged ( bool active );
|
||||||
|
void directionChanged ( Direction direction );
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void reset();
|
||||||
|
void setActive ( bool active );
|
||||||
|
void setInterval ( int msec );
|
||||||
|
void start();
|
||||||
|
void stop();
|
||||||
|
void setDirection ( Direction param_direciton );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void enterEvent ( QEvent* event );
|
||||||
|
virtual void leaveEvent ( QEvent* event );
|
||||||
|
virtual void resizeEvent ( QResizeEvent* event );
|
||||||
|
virtual void timerEvent ( QTimerEvent* event );
|
||||||
|
virtual void paintEvent ( QPaintEvent* event );
|
||||||
|
|
||||||
|
private:
|
||||||
|
int marqueeMargin;
|
||||||
|
int timerId;
|
||||||
|
int mInterval;
|
||||||
|
bool active;
|
||||||
|
bool mouseIn;
|
||||||
|
Direction mDirection;
|
||||||
|
};
|
||||||
|
#endif // QQTMARQUEELABEL_H
|
@ -1,6 +0,0 @@
|
|||||||
#include "qqtninepatcheffectwidget.h"
|
|
||||||
|
|
||||||
QQtNinePatchEffectWidget::QQtNinePatchEffectWidget(QWidget *parent) : QWidget(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,149 +0,0 @@
|
|||||||
#ifndef QQTNINEPATCHEFFECTWIDGET_H
|
|
||||||
#define QQTNINEPATCHEFFECTWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <qqtcore.h>
|
|
||||||
#include <qqt-local.h>
|
|
||||||
|
|
||||||
class QQTSHARED_EXPORT QQtNinePatchEffectWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QQtNinePatchEffectWidget(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/*
|
|
||||||
** 功能 : 9格图处理
|
|
||||||
** picName : 图片名字
|
|
||||||
** titleHeight : 标题栏高度(单位:像素)
|
|
||||||
** BorderLineWidth : 边框宽度(单位:像素)
|
|
||||||
** parent : 带画背景的窗口句柄
|
|
||||||
** 返回值 :处理完成的图片
|
|
||||||
*/
|
|
||||||
QPixmap* NinePatch(QString& picName, int titleHeight, int BorderLineWidth, QWidget* Wnd)
|
|
||||||
{
|
|
||||||
QPixmap* pix = new QPixmap(picName);
|
|
||||||
|
|
||||||
int pixWidth = pix->width();
|
|
||||||
int pixHeight = pix->height();
|
|
||||||
|
|
||||||
QSize WndSize = Wnd->size();
|
|
||||||
int DstWidth = WndSize.width();
|
|
||||||
int DstHeight = WndSize.height();
|
|
||||||
|
|
||||||
QPixmap pix_1 = pix->copy(0, 0, BorderLineWidth, titleHeight);
|
|
||||||
QPixmap pix_2 = pix->copy(BorderLineWidth, 0, pixWidth - BorderLineWidth * 2, titleHeight);
|
|
||||||
QPixmap pix_3 = pix->copy(pixWidth - BorderLineWidth, 0, BorderLineWidth, titleHeight);
|
|
||||||
|
|
||||||
QPixmap pix_4 = pix->copy(0, titleHeight, BorderLineWidth, pixHeight - titleHeight - BorderLineWidth);
|
|
||||||
QPixmap pix_5 = pix->copy(BorderLineWidth, titleHeight, pixWidth - BorderLineWidth * 2,
|
|
||||||
pixHeight - titleHeight - BorderLineWidth);
|
|
||||||
QPixmap pix_6 = pix->copy(pixWidth - BorderLineWidth, titleHeight, BorderLineWidth,
|
|
||||||
pixHeight - titleHeight - BorderLineWidth);
|
|
||||||
|
|
||||||
QPixmap pix_7 = pix->copy(0, pixHeight - BorderLineWidth, BorderLineWidth, BorderLineWidth);
|
|
||||||
QPixmap pix_8 = pix->copy(BorderLineWidth, pixHeight - BorderLineWidth, pixWidth - BorderLineWidth * 2,
|
|
||||||
BorderLineWidth);
|
|
||||||
QPixmap pix_9 = pix->copy(pixWidth - BorderLineWidth, pixHeight - BorderLineWidth, BorderLineWidth, BorderLineWidth);
|
|
||||||
|
|
||||||
pix_2 = pix_2.scaled(DstWidth - BorderLineWidth * 2, titleHeight, Qt::IgnoreAspectRatio); //保持高度拉宽
|
|
||||||
pix_4 = pix_4.scaled(BorderLineWidth, DstHeight - titleHeight - BorderLineWidth,
|
|
||||||
Qt::IgnoreAspectRatio); //保持宽度拉高
|
|
||||||
pix_5 = pix_5.scaled(DstWidth - 3, DstHeight - titleHeight - BorderLineWidth);
|
|
||||||
pix_6 = pix_6.scaled(BorderLineWidth, DstHeight - titleHeight - BorderLineWidth,
|
|
||||||
Qt::IgnoreAspectRatio); //保持宽度拉高
|
|
||||||
pix_8 = pix_8.scaled(DstWidth - BorderLineWidth * 2, BorderLineWidth); //保持高度拉宽
|
|
||||||
|
|
||||||
|
|
||||||
QPixmap* resultImg = new QPixmap(WndSize);
|
|
||||||
QPainter* painter = new QPainter(resultImg);
|
|
||||||
|
|
||||||
if (!resultImg->isNull())
|
|
||||||
{
|
|
||||||
painter->drawPixmap(0, 0, pix_1);
|
|
||||||
painter->drawPixmap(3, 0, pix_2);
|
|
||||||
painter->drawPixmap(DstWidth - 3, 0, pix_3);
|
|
||||||
painter->drawPixmap(0, titleHeight, pix_4);
|
|
||||||
painter->drawPixmap(3, titleHeight, pix_5);
|
|
||||||
painter->drawPixmap(DstWidth - 3, titleHeight, pix_6);
|
|
||||||
painter->drawPixmap(0, DstHeight - 3, pix_7);
|
|
||||||
painter->drawPixmap(3, DstHeight - 3, pix_8);
|
|
||||||
painter->drawPixmap(DstWidth - 3, DstHeight - 3, pix_9);
|
|
||||||
painter->end();
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultImg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** 功能 : 九宫格图处理
|
|
||||||
** picName : 图片名字
|
|
||||||
** iHorzSplit : 四个角上格子的宽度
|
|
||||||
** iVertSplit : 四个角上格子的高度
|
|
||||||
** DstWidth : 整个图片缩放的宽度
|
|
||||||
** DstWidth : 整个图片缩放的高度
|
|
||||||
** 返回值 : 处理完成的图片
|
|
||||||
*/
|
|
||||||
QPixmap* NinePatch(QString& picName, int iHorzSplit, int iVertSplit, int DstWidth, int DstHeight)
|
|
||||||
{
|
|
||||||
QPixmap* pix = new QPixmap(picName);
|
|
||||||
|
|
||||||
int pixWidth = pix->width();
|
|
||||||
int pixHeight = pix->height();
|
|
||||||
|
|
||||||
QPixmap pix_1 = pix->copy(0, 0, iHorzSplit, iVertSplit);
|
|
||||||
QPixmap pix_2 = pix->copy(iHorzSplit, 0, pixWidth - iHorzSplit * 2, iVertSplit);
|
|
||||||
QPixmap pix_3 = pix->copy(pixWidth - iHorzSplit, 0, iHorzSplit, iVertSplit);
|
|
||||||
|
|
||||||
QPixmap pix_4 = pix->copy(0, iVertSplit, iHorzSplit, pixHeight - iVertSplit * 2);
|
|
||||||
QPixmap pix_5 = pix->copy(iHorzSplit, iVertSplit, pixWidth - iHorzSplit * 2, pixHeight - iVertSplit * 2);
|
|
||||||
QPixmap pix_6 = pix->copy(pixWidth - iHorzSplit, iVertSplit, iHorzSplit, pixHeight - iVertSplit * 2);
|
|
||||||
|
|
||||||
QPixmap pix_7 = pix->copy(0, pixHeight - iVertSplit, iHorzSplit, iVertSplit);
|
|
||||||
QPixmap pix_8 = pix->copy(iHorzSplit, pixHeight - iVertSplit, pixWidth - iHorzSplit * 2, pixWidth - iHorzSplit * 2);
|
|
||||||
QPixmap pix_9 = pix->copy(pixWidth - iHorzSplit, pixHeight - iVertSplit, iHorzSplit, iVertSplit);
|
|
||||||
|
|
||||||
pix_2 = pix_2.scaled(DstWidth - iHorzSplit * 2, iVertSplit, Qt::IgnoreAspectRatio); //保持高度拉宽
|
|
||||||
pix_4 = pix_4.scaled(iHorzSplit, DstHeight - iVertSplit * 2, Qt::IgnoreAspectRatio); //保持宽度拉高
|
|
||||||
pix_5 = pix_5.scaled(DstWidth - iHorzSplit * 2, DstHeight - iVertSplit * 2,
|
|
||||||
Qt::IgnoreAspectRatio); //宽高都缩放
|
|
||||||
pix_6 = pix_6.scaled(iHorzSplit, DstHeight - iVertSplit * 2, Qt::IgnoreAspectRatio); //保持宽度拉高
|
|
||||||
pix_8 = pix_8.scaled(DstWidth - iHorzSplit * 2, iVertSplit); //保持高度拉宽
|
|
||||||
|
|
||||||
|
|
||||||
QPixmap* resultImg = new QPixmap(DstWidth, DstHeight);
|
|
||||||
QPainter* painter = new QPainter(resultImg);
|
|
||||||
|
|
||||||
if (!resultImg->isNull())
|
|
||||||
{
|
|
||||||
painter->drawPixmap(0, 0, pix_1);
|
|
||||||
painter->drawPixmap(iHorzSplit, 0, pix_2);
|
|
||||||
painter->drawPixmap(DstWidth - iHorzSplit, 0, pix_3);
|
|
||||||
|
|
||||||
painter->drawPixmap(0, iVertSplit, pix_4);
|
|
||||||
painter->drawPixmap(iHorzSplit, iVertSplit, pix_5);
|
|
||||||
painter->drawPixmap(DstWidth - iHorzSplit, iVertSplit, pix_6);
|
|
||||||
|
|
||||||
painter->drawPixmap(0, DstHeight - iVertSplit, pix_7);
|
|
||||||
painter->drawPixmap(iHorzSplit, DstHeight - iVertSplit, pix_8);
|
|
||||||
painter->drawPixmap(DstWidth - iHorzSplit, DstHeight - iVertSplit, pix_9);
|
|
||||||
painter->end();
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultImg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 如果是个聊天气泡,四周的图片还能缩放吗?
|
|
||||||
*/
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QQTNINEPATCHEFFECTWIDGET_H
|
|
6
src/exquisite/qqtninepatchwidget.cpp
Normal file
6
src/exquisite/qqtninepatchwidget.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "qqtninepatchwidget.h"
|
||||||
|
|
||||||
|
QQtNinePatchWidget::QQtNinePatchWidget(QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
145
src/exquisite/qqtninepatchwidget.h
Normal file
145
src/exquisite/qqtninepatchwidget.h
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#ifndef QQTNINEPATCHWIDGET_H
|
||||||
|
#define QQTNINEPATCHWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <qqtcore.h>
|
||||||
|
#include <qqt-local.h>
|
||||||
|
|
||||||
|
class QQTSHARED_EXPORT QQtNinePatchWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtNinePatchWidget ( QWidget* parent = nullptr );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/*
|
||||||
|
** 功能 : 9格图处理
|
||||||
|
** picName : 图片名字
|
||||||
|
** titleHeight : 标题栏高度(单位:像素)
|
||||||
|
** BorderLineWidth : 边框宽度(单位:像素)
|
||||||
|
** parent : 带画背景的窗口句柄
|
||||||
|
** 返回值 :处理完成的图片
|
||||||
|
*/
|
||||||
|
QPixmap* NinePatch ( QString& picName, int titleHeight, int BorderLineWidth, QWidget* Wnd ) {
|
||||||
|
QPixmap* pix = new QPixmap ( picName );
|
||||||
|
|
||||||
|
int pixWidth = pix->width();
|
||||||
|
int pixHeight = pix->height();
|
||||||
|
|
||||||
|
QSize WndSize = Wnd->size();
|
||||||
|
int DstWidth = WndSize.width();
|
||||||
|
int DstHeight = WndSize.height();
|
||||||
|
|
||||||
|
QPixmap pix_1 = pix->copy ( 0, 0, BorderLineWidth, titleHeight );
|
||||||
|
QPixmap pix_2 = pix->copy ( BorderLineWidth, 0, pixWidth - BorderLineWidth * 2, titleHeight );
|
||||||
|
QPixmap pix_3 = pix->copy ( pixWidth - BorderLineWidth, 0, BorderLineWidth, titleHeight );
|
||||||
|
|
||||||
|
QPixmap pix_4 = pix->copy ( 0, titleHeight, BorderLineWidth, pixHeight - titleHeight - BorderLineWidth );
|
||||||
|
QPixmap pix_5 = pix->copy ( BorderLineWidth, titleHeight, pixWidth - BorderLineWidth * 2,
|
||||||
|
pixHeight - titleHeight - BorderLineWidth );
|
||||||
|
QPixmap pix_6 = pix->copy ( pixWidth - BorderLineWidth, titleHeight, BorderLineWidth,
|
||||||
|
pixHeight - titleHeight - BorderLineWidth );
|
||||||
|
|
||||||
|
QPixmap pix_7 = pix->copy ( 0, pixHeight - BorderLineWidth, BorderLineWidth, BorderLineWidth );
|
||||||
|
QPixmap pix_8 = pix->copy ( BorderLineWidth, pixHeight - BorderLineWidth, pixWidth - BorderLineWidth * 2,
|
||||||
|
BorderLineWidth );
|
||||||
|
QPixmap pix_9 = pix->copy ( pixWidth - BorderLineWidth, pixHeight - BorderLineWidth, BorderLineWidth, BorderLineWidth );
|
||||||
|
|
||||||
|
pix_2 = pix_2.scaled ( DstWidth - BorderLineWidth * 2, titleHeight, Qt::IgnoreAspectRatio ); //保持高度拉宽
|
||||||
|
pix_4 = pix_4.scaled ( BorderLineWidth, DstHeight - titleHeight - BorderLineWidth,
|
||||||
|
Qt::IgnoreAspectRatio ); //保持宽度拉高
|
||||||
|
pix_5 = pix_5.scaled ( DstWidth - 3, DstHeight - titleHeight - BorderLineWidth );
|
||||||
|
pix_6 = pix_6.scaled ( BorderLineWidth, DstHeight - titleHeight - BorderLineWidth,
|
||||||
|
Qt::IgnoreAspectRatio ); //保持宽度拉高
|
||||||
|
pix_8 = pix_8.scaled ( DstWidth - BorderLineWidth * 2, BorderLineWidth ); //保持高度拉宽
|
||||||
|
|
||||||
|
|
||||||
|
QPixmap* resultImg = new QPixmap ( WndSize );
|
||||||
|
QPainter* painter = new QPainter ( resultImg );
|
||||||
|
|
||||||
|
if ( !resultImg->isNull() ) {
|
||||||
|
painter->drawPixmap ( 0, 0, pix_1 );
|
||||||
|
painter->drawPixmap ( 3, 0, pix_2 );
|
||||||
|
painter->drawPixmap ( DstWidth - 3, 0, pix_3 );
|
||||||
|
painter->drawPixmap ( 0, titleHeight, pix_4 );
|
||||||
|
painter->drawPixmap ( 3, titleHeight, pix_5 );
|
||||||
|
painter->drawPixmap ( DstWidth - 3, titleHeight, pix_6 );
|
||||||
|
painter->drawPixmap ( 0, DstHeight - 3, pix_7 );
|
||||||
|
painter->drawPixmap ( 3, DstHeight - 3, pix_8 );
|
||||||
|
painter->drawPixmap ( DstWidth - 3, DstHeight - 3, pix_9 );
|
||||||
|
painter->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** 功能 : 九宫格图处理
|
||||||
|
** picName : 图片名字
|
||||||
|
** iHorzSplit : 四个角上格子的宽度
|
||||||
|
** iVertSplit : 四个角上格子的高度
|
||||||
|
** DstWidth : 整个图片缩放的宽度
|
||||||
|
** DstWidth : 整个图片缩放的高度
|
||||||
|
** 返回值 : 处理完成的图片
|
||||||
|
*/
|
||||||
|
QPixmap* NinePatch ( QString& picName, int iHorzSplit, int iVertSplit, int DstWidth, int DstHeight ) {
|
||||||
|
QPixmap* pix = new QPixmap ( picName );
|
||||||
|
|
||||||
|
int pixWidth = pix->width();
|
||||||
|
int pixHeight = pix->height();
|
||||||
|
|
||||||
|
QPixmap pix_1 = pix->copy ( 0, 0, iHorzSplit, iVertSplit );
|
||||||
|
QPixmap pix_2 = pix->copy ( iHorzSplit, 0, pixWidth - iHorzSplit * 2, iVertSplit );
|
||||||
|
QPixmap pix_3 = pix->copy ( pixWidth - iHorzSplit, 0, iHorzSplit, iVertSplit );
|
||||||
|
|
||||||
|
QPixmap pix_4 = pix->copy ( 0, iVertSplit, iHorzSplit, pixHeight - iVertSplit * 2 );
|
||||||
|
QPixmap pix_5 = pix->copy ( iHorzSplit, iVertSplit, pixWidth - iHorzSplit * 2, pixHeight - iVertSplit * 2 );
|
||||||
|
QPixmap pix_6 = pix->copy ( pixWidth - iHorzSplit, iVertSplit, iHorzSplit, pixHeight - iVertSplit * 2 );
|
||||||
|
|
||||||
|
QPixmap pix_7 = pix->copy ( 0, pixHeight - iVertSplit, iHorzSplit, iVertSplit );
|
||||||
|
QPixmap pix_8 = pix->copy ( iHorzSplit, pixHeight - iVertSplit, pixWidth - iHorzSplit * 2, pixWidth - iHorzSplit * 2 );
|
||||||
|
QPixmap pix_9 = pix->copy ( pixWidth - iHorzSplit, pixHeight - iVertSplit, iHorzSplit, iVertSplit );
|
||||||
|
|
||||||
|
pix_2 = pix_2.scaled ( DstWidth - iHorzSplit * 2, iVertSplit, Qt::IgnoreAspectRatio ); //保持高度拉宽
|
||||||
|
pix_4 = pix_4.scaled ( iHorzSplit, DstHeight - iVertSplit * 2, Qt::IgnoreAspectRatio ); //保持宽度拉高
|
||||||
|
pix_5 = pix_5.scaled ( DstWidth - iHorzSplit * 2, DstHeight - iVertSplit * 2,
|
||||||
|
Qt::IgnoreAspectRatio ); //宽高都缩放
|
||||||
|
pix_6 = pix_6.scaled ( iHorzSplit, DstHeight - iVertSplit * 2, Qt::IgnoreAspectRatio ); //保持宽度拉高
|
||||||
|
pix_8 = pix_8.scaled ( DstWidth - iHorzSplit * 2, iVertSplit ); //保持高度拉宽
|
||||||
|
|
||||||
|
|
||||||
|
QPixmap* resultImg = new QPixmap ( DstWidth, DstHeight );
|
||||||
|
QPainter* painter = new QPainter ( resultImg );
|
||||||
|
|
||||||
|
if ( !resultImg->isNull() ) {
|
||||||
|
painter->drawPixmap ( 0, 0, pix_1 );
|
||||||
|
painter->drawPixmap ( iHorzSplit, 0, pix_2 );
|
||||||
|
painter->drawPixmap ( DstWidth - iHorzSplit, 0, pix_3 );
|
||||||
|
|
||||||
|
painter->drawPixmap ( 0, iVertSplit, pix_4 );
|
||||||
|
painter->drawPixmap ( iHorzSplit, iVertSplit, pix_5 );
|
||||||
|
painter->drawPixmap ( DstWidth - iHorzSplit, iVertSplit, pix_6 );
|
||||||
|
|
||||||
|
painter->drawPixmap ( 0, DstHeight - iVertSplit, pix_7 );
|
||||||
|
painter->drawPixmap ( iHorzSplit, DstHeight - iVertSplit, pix_8 );
|
||||||
|
painter->drawPixmap ( DstWidth - iHorzSplit, DstHeight - iVertSplit, pix_9 );
|
||||||
|
painter->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 如果是个聊天气泡,四周的图片还能缩放吗?
|
||||||
|
*/
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTNINEPATCHWIDGET_H
|
@ -1,16 +0,0 @@
|
|||||||
#include "qqtpictureeffecttabwidget.h"
|
|
||||||
|
|
||||||
QQtPictureEffectTabWidget::QQtPictureEffectTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
|
||||||
{
|
|
||||||
m_bar = new QQtPictureEffectTabBar(this);
|
|
||||||
setTabBar(m_bar);
|
|
||||||
/*
|
|
||||||
* pline() << "这是我设置的bar:" << bar;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPictureEffectTabWidget::setObjectName(const QString& name)
|
|
||||||
{
|
|
||||||
m_bar->setObjectName(QString("%1_bar").arg(name));
|
|
||||||
return QQtTabWidget::setObjectName(name);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#ifndef QQTPICTUREEFFECTTABWIDGET_H
|
|
||||||
#define QQTPICTUREEFFECTTABWIDGET_H
|
|
||||||
|
|
||||||
#include <qqttabwidget.h>
|
|
||||||
#include <qqtpictureeffecttabbar.h>
|
|
||||||
|
|
||||||
class QQtPictureEffectTabWidget : public QQtTabWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QQtPictureEffectTabWidget(QWidget* parent = nullptr);
|
|
||||||
virtual ~QQtPictureEffectTabWidget() {}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
private:
|
|
||||||
QQtPictureEffectTabBar* m_bar;
|
|
||||||
|
|
||||||
// QQtTabWidget interface
|
|
||||||
public:
|
|
||||||
virtual void setObjectName(const QString& name) override;
|
|
||||||
virtual QQtTabBar* localTabBar() const override { return m_bar; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QQTPICTUREEFFECTTABWIDGET_H
|
|
@ -1,4 +1,4 @@
|
|||||||
#include "qqtpictureeffecttabbar.h"
|
#include "qqtpicturetabbar.h"
|
||||||
#include "QStylePainter"
|
#include "QStylePainter"
|
||||||
#include "QStyleOptionTabV3"
|
#include "QStyleOptionTabV3"
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#include "QToolButton"
|
#include "QToolButton"
|
||||||
#include "qqtcore.h"
|
#include "qqtcore.h"
|
||||||
|
|
||||||
QQtPictureEffectTabBar::QQtPictureEffectTabBar ( QWidget* parent ) :
|
QQtPictureTabBar::QQtPictureTabBar ( QWidget* parent ) :
|
||||||
QQtTabBar ( parent )
|
QQtTabBar ( parent )
|
||||||
{
|
{
|
||||||
setFocusPolicy ( Qt::NoFocus );
|
setFocusPolicy ( Qt::NoFocus );
|
||||||
@ -20,7 +20,7 @@ QQtPictureEffectTabBar::QQtPictureEffectTabBar ( QWidget* parent ) :
|
|||||||
setDrawBase ( true );
|
setDrawBase ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setIconStyle ( QQtPictureEffectTabBar::IconStyle iconStyle )
|
void QQtPictureTabBar::setIconStyle ( QQtPictureTabBar::IconStyle iconStyle )
|
||||||
{
|
{
|
||||||
if ( this->iconStyle != iconStyle )
|
if ( this->iconStyle != iconStyle )
|
||||||
{
|
{
|
||||||
@ -29,7 +29,7 @@ void QQtPictureEffectTabBar::setIconStyle ( QQtPictureEffectTabBar::IconStyle ic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setTextFont ( QFont textFont )
|
void QQtPictureTabBar::setTextFont ( QFont textFont )
|
||||||
{
|
{
|
||||||
if ( this->textFont != textFont )
|
if ( this->textFont != textFont )
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ void QQtPictureEffectTabBar::setTextFont ( QFont textFont )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setTextColor ( QColor textColor )
|
void QQtPictureTabBar::setTextColor ( QColor textColor )
|
||||||
{
|
{
|
||||||
if ( this->textColor != textColor )
|
if ( this->textColor != textColor )
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ void QQtPictureEffectTabBar::setTextColor ( QColor textColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setSelectedTextColor ( QColor selectedTextColor )
|
void QQtPictureTabBar::setSelectedTextColor ( QColor selectedTextColor )
|
||||||
{
|
{
|
||||||
if ( this->selectedTextColor != selectedTextColor )
|
if ( this->selectedTextColor != selectedTextColor )
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ void QQtPictureEffectTabBar::setSelectedTextColor ( QColor selectedTextColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::tabPixmap ( int index, QImage& img, QImage& imgSel )
|
void QQtPictureTabBar::tabPixmap ( int index, QImage& img, QImage& imgSel )
|
||||||
{
|
{
|
||||||
if ( index < 0 || index + 1 > count() || index + 1 > imgList.size() )
|
if ( index < 0 || index + 1 > count() || index + 1 > imgList.size() )
|
||||||
return;
|
return;
|
||||||
@ -67,7 +67,7 @@ void QQtPictureEffectTabBar::tabPixmap ( int index, QImage& img, QImage& imgSel
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setTabPixmap ( int index, const QString& img, const QString& imgSel )
|
void QQtPictureTabBar::setTabPixmap ( int index, const QString& img, const QString& imgSel )
|
||||||
{
|
{
|
||||||
if ( index < 0 || index + 1 > count() )
|
if ( index < 0 || index + 1 > count() )
|
||||||
return;
|
return;
|
||||||
@ -79,7 +79,7 @@ void QQtPictureEffectTabBar::setTabPixmap ( int index, const QString& img, const
|
|||||||
imgList.insert ( index, table );
|
imgList.insert ( index, table );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::tabIcon ( int index, QImage& icon, QImage& iconSel )
|
void QQtPictureTabBar::tabIcon ( int index, QImage& icon, QImage& iconSel )
|
||||||
{
|
{
|
||||||
if ( index < 0 || index + 1 > count() || index + 1 > imgList.size() )
|
if ( index < 0 || index + 1 > count() || index + 1 > imgList.size() )
|
||||||
return;
|
return;
|
||||||
@ -90,7 +90,7 @@ void QQtPictureEffectTabBar::tabIcon ( int index, QImage& icon, QImage& iconSel
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setTabIcon ( int index, const QString& icon, const QString& iconSel )
|
void QQtPictureTabBar::setTabIcon ( int index, const QString& icon, const QString& iconSel )
|
||||||
{
|
{
|
||||||
if ( index < 0 || index + 1 > count() )
|
if ( index < 0 || index + 1 > count() )
|
||||||
return;
|
return;
|
||||||
@ -102,7 +102,7 @@ void QQtPictureEffectTabBar::setTabIcon ( int index, const QString& icon, const
|
|||||||
iconList.insert ( index, table );
|
iconList.insert ( index, table );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::setBackgroundColor ( QColor backgroundColor )
|
void QQtPictureTabBar::setBackgroundColor ( QColor backgroundColor )
|
||||||
{
|
{
|
||||||
if ( this->backgroundColor != backgroundColor )
|
if ( this->backgroundColor != backgroundColor )
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ void QQtPictureEffectTabBar::setBackgroundColor ( QColor backgroundColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::paintEvent ( QPaintEvent* e )
|
void QQtPictureTabBar::paintEvent ( QPaintEvent* e )
|
||||||
{
|
{
|
||||||
Q_UNUSED ( e )
|
Q_UNUSED ( e )
|
||||||
QPainter p ( this );
|
QPainter p ( this );
|
||||||
@ -120,7 +120,7 @@ void QQtPictureEffectTabBar::paintEvent ( QPaintEvent* e )
|
|||||||
drawText ( &p );
|
drawText ( &p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::drawBackground ( QPainter* p )
|
void QQtPictureTabBar::drawBackground ( QPainter* p )
|
||||||
{
|
{
|
||||||
bool b = drawBase();
|
bool b = drawBase();
|
||||||
|
|
||||||
@ -130,25 +130,25 @@ void QQtPictureEffectTabBar::drawBackground ( QPainter* p )
|
|||||||
|
|
||||||
switch ( iconStyle )
|
switch ( iconStyle )
|
||||||
{
|
{
|
||||||
case IconStyle_Top_And_BottomText:
|
case IconStyle_Top_And_BottomText:
|
||||||
case IconStyle_Bottom_And_TopText:
|
case IconStyle_Bottom_And_TopText:
|
||||||
case IconStyle_Left_And_RightText:
|
case IconStyle_Left_And_RightText:
|
||||||
case IconStyle_Right_And_LeftText:
|
case IconStyle_Right_And_LeftText:
|
||||||
case IconStyle_MiddleText:
|
case IconStyle_MiddleText:
|
||||||
drawPicture ( p );
|
drawPicture ( p );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ColorStyle_Left_And_RightText:
|
case ColorStyle_Left_And_RightText:
|
||||||
drawColor ( p );
|
drawColor ( p );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IconStyle_Max_Style:
|
case IconStyle_Max_Style:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::drawPicture ( QPainter* p )
|
void QQtPictureTabBar::drawPicture ( QPainter* p )
|
||||||
{
|
{
|
||||||
for ( int index = 0; index < count(); index++ )
|
for ( int index = 0; index < count(); index++ )
|
||||||
{
|
{
|
||||||
@ -158,19 +158,33 @@ void QQtPictureEffectTabBar::drawPicture ( QPainter* p )
|
|||||||
{
|
{
|
||||||
p->save();
|
p->save();
|
||||||
int sel = currentIndex() == index ? BTN_PRESS : BTN_NORMAL;
|
int sel = currentIndex() == index ? BTN_PRESS : BTN_NORMAL;
|
||||||
|
#if 1
|
||||||
//tabRect = rect()?
|
//tabRect = rect()?
|
||||||
p->drawPixmap ( tRect0, QIcon ( imgList[index][sel] ).pixmap ( tRect0.size(), QIcon::Normal, QIcon::On ) );
|
p->drawPixmap ( tRect0, QIcon ( imgList[index][sel] ).pixmap ( tRect0.size(), QIcon::Normal, QIcon::On ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 失真不明显,使用以下方法
|
* 失真不明显,使用以下方法
|
||||||
*/
|
*/
|
||||||
//QImage image(iconList[index][sel]);
|
#if 0
|
||||||
//p.drawItemPixmap(tabRectValue, Qt::AlignLeft |Qt::AlignTop, QPixmap::fromImage(image.scaled(tabRectValue.size(), Qt::KeepAspectRatio)));
|
QImage image ( iconList[index][sel] );
|
||||||
|
p.drawItemPixmap ( tabRectValue, Qt::AlignLeft | Qt::AlignTop, QPixmap::fromImage ( image.scaled ( tabRectValue.size(),
|
||||||
|
Qt::KeepAspectRatio ) ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//需要QStylePainter支援
|
||||||
|
//为什么不用这个呢?因为上边那个QIcon直接缩放到了完整的符合Icon大小的图.直接居中.
|
||||||
|
//这个不需要,多次一举.
|
||||||
|
#if 0
|
||||||
|
p->drawItemPixmap ( tRect0, Qt::AlignCenter, QIcon ( imgList[index][sel] ).pixmap ( tRect0.size(), QIcon::Normal,
|
||||||
|
QIcon::On ) );
|
||||||
|
#endif
|
||||||
p->restore();
|
p->restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::drawColor ( QPainter* p )
|
void QQtPictureTabBar::drawColor ( QPainter* p )
|
||||||
{
|
{
|
||||||
for ( int index = 0; index < count(); index++ )
|
for ( int index = 0; index < count(); index++ )
|
||||||
{
|
{
|
||||||
@ -184,7 +198,7 @@ void QQtPictureEffectTabBar::drawColor ( QPainter* p )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::drawIcon ( QPainter* p )
|
void QQtPictureTabBar::drawIcon ( QPainter* p )
|
||||||
{
|
{
|
||||||
if ( iconStyle == IconStyle_MiddleText )
|
if ( iconStyle == IconStyle_MiddleText )
|
||||||
return;
|
return;
|
||||||
@ -255,7 +269,7 @@ void QQtPictureEffectTabBar::drawIcon ( QPainter* p )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtPictureEffectTabBar::drawText ( QPainter* p )
|
void QQtPictureTabBar::drawText ( QPainter* p )
|
||||||
{
|
{
|
||||||
for ( int index = 0; index < count(); index++ )
|
for ( int index = 0; index < count(); index++ )
|
||||||
{
|
{
|
||||||
@ -274,14 +288,14 @@ void QQtPictureEffectTabBar::drawText ( QPainter* p )
|
|||||||
tRect0 = QRect ( tRect0.left(),
|
tRect0 = QRect ( tRect0.left(),
|
||||||
tRect0.top() + iconSize().height() + spacing,
|
tRect0.top() + iconSize().height() + spacing,
|
||||||
tRect0.width(),
|
tRect0.width(),
|
||||||
tRect0.height() - (iconSize().height() + spacing) );
|
tRect0.height() - ( iconSize().height() + spacing ) );
|
||||||
}
|
}
|
||||||
else if ( iconStyle == IconStyle_Bottom_And_TopText )
|
else if ( iconStyle == IconStyle_Bottom_And_TopText )
|
||||||
{
|
{
|
||||||
tRect0 = QRect ( tRect0.left(),
|
tRect0 = QRect ( tRect0.left(),
|
||||||
tRect0.top(),
|
tRect0.top(),
|
||||||
tRect0.width(),
|
tRect0.width(),
|
||||||
tRect0.height() - (iconSize().height() + spacing) );
|
tRect0.height() - ( iconSize().height() + spacing ) );
|
||||||
}
|
}
|
||||||
else if ( iconStyle == IconStyle_Right_And_LeftText )
|
else if ( iconStyle == IconStyle_Right_And_LeftText )
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTPICTUREEFFECTTABBAR_H
|
#ifndef QQTPICTURETABBAR_H
|
||||||
#define QQTPICTUREEFFECTTABBAR_H
|
#define QQTPICTURETABBAR_H
|
||||||
|
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@ -9,12 +9,12 @@
|
|||||||
#include "qqttabbar.h"
|
#include "qqttabbar.h"
|
||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
class QQTSHARED_EXPORT QQtPictureEffectTabBar : public QQtTabBar
|
class QQTSHARED_EXPORT QQtPictureTabBar : public QQtTabBar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QQtPictureEffectTabBar ( QWidget* parent = 0 );
|
explicit QQtPictureTabBar ( QWidget* parent = 0 );
|
||||||
|
|
||||||
enum IconStyle
|
enum IconStyle
|
||||||
{
|
{
|
||||||
@ -39,15 +39,17 @@ public:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 设置x方向、y方向的layout间距。
|
* 设置x方向、y方向的layout间距。
|
||||||
|
* setContentsMargins(left, top, right, bottom); is a gool idea.
|
||||||
*/
|
*/
|
||||||
void setLayoutSpacing(int spacing = 0) { this->spacing = spacing; }
|
void setLayoutSpacing ( int spacing = 0 ) { this->spacing = spacing; }
|
||||||
//setContentsMargins(left, top, right, bottom); is a gool idea.
|
|
||||||
|
|
||||||
/*TabBar的风格*/
|
/*TabBar的风格*/
|
||||||
IconStyle getIconStyle() const { return iconStyle; }
|
IconStyle getIconStyle() const { return iconStyle; }
|
||||||
void setIconStyle ( IconStyle iconStyle );
|
void setIconStyle ( IconStyle iconStyle );
|
||||||
|
|
||||||
/*背景部分,这里设置的是Tab的背景图*/
|
/**
|
||||||
|
* 背景部分,这里设置的是Tab的背景图
|
||||||
|
*/
|
||||||
/*使用颜色*/
|
/*使用颜色*/
|
||||||
QColor getBackgroundColor() const { return backgroundColor; }
|
QColor getBackgroundColor() const { return backgroundColor; }
|
||||||
void setBackgroundColor ( QColor backgroundColor );//effected by drawbase
|
void setBackgroundColor ( QColor backgroundColor );//effected by drawbase
|
||||||
@ -56,7 +58,10 @@ public:
|
|||||||
void setTabPixmap ( int index, const QString& img = QString(),
|
void setTabPixmap ( int index, const QString& img = QString(),
|
||||||
const QString& imgSel = QString() );
|
const QString& imgSel = QString() );
|
||||||
|
|
||||||
/*Icon部分,这里设置的是Tab里的Icon*/
|
/**
|
||||||
|
* Icon部分,这里设置的是Tab里的Icon
|
||||||
|
* 不设置背景则显示icon
|
||||||
|
*/
|
||||||
void tabIcon ( int index, QImage& icon, QImage& iconSel );
|
void tabIcon ( int index, QImage& icon, QImage& iconSel );
|
||||||
void setTabIcon ( int index, const QString& icon = QString(),
|
void setTabIcon ( int index, const QString& icon = QString(),
|
||||||
const QString& iconSel = QString() );
|
const QString& iconSel = QString() );
|
||||||
@ -90,4 +95,4 @@ private:
|
|||||||
int spacing;
|
int spacing;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTPICTUREEFFECTTABBAR_H
|
#endif // QQTPICTURETABBAR_H
|
16
src/exquisite/qqtpicturetabwidget.cpp
Normal file
16
src/exquisite/qqtpicturetabwidget.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "qqtpicturetabwidget.h"
|
||||||
|
|
||||||
|
QQtPictureTabWidget::QQtPictureTabWidget ( QWidget* parent ) : QQtTabWidget ( parent )
|
||||||
|
{
|
||||||
|
m_bar = new QQtPictureTabBar ( this );
|
||||||
|
setTabBar ( m_bar );
|
||||||
|
/*
|
||||||
|
* pline() << "这是我设置的bar:" << bar;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPictureTabWidget::setObjectName ( const QString& name )
|
||||||
|
{
|
||||||
|
m_bar->setObjectName ( QString ( "%1_bar" ).arg ( name ) );
|
||||||
|
return QQtTabWidget::setObjectName ( name );
|
||||||
|
}
|
26
src/exquisite/qqtpicturetabwidget.h
Normal file
26
src/exquisite/qqtpicturetabwidget.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef QQTPICTURETABWIDGET_H
|
||||||
|
#define QQTPICTURETABWIDGET_H
|
||||||
|
|
||||||
|
#include <qqttabwidget.h>
|
||||||
|
#include <qqtpicturetabbar.h>
|
||||||
|
|
||||||
|
class QQtPictureTabWidget : public QQtTabWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtPictureTabWidget ( QWidget* parent = nullptr );
|
||||||
|
virtual ~QQtPictureTabWidget() {}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
private:
|
||||||
|
QQtPictureTabBar* m_bar;
|
||||||
|
|
||||||
|
// QQtTabWidget interface
|
||||||
|
public:
|
||||||
|
virtual void setObjectName ( const QString& name ) override;
|
||||||
|
virtual QQtTabBar* localTabBar() const override { return m_bar; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTPICTURETABWIDGET_H
|
@ -1,102 +0,0 @@
|
|||||||
#include "qqtpopeffectdialog.h"
|
|
||||||
|
|
||||||
QQtPopEffectDialog::QQtPopEffectDialog(QWidget* parent) : QDialog(parent)
|
|
||||||
{
|
|
||||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
|
|
||||||
mIsPause = false;
|
|
||||||
remainTimer = NULL;
|
|
||||||
animation = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::showPopDialog(quint32 paramRemainTime)
|
|
||||||
{
|
|
||||||
mremainTime = paramRemainTime * 500;
|
|
||||||
this->move((desktop.availableGeometry().width() - this->width()), desktop.availableGeometry().height());
|
|
||||||
|
|
||||||
if (!this->isVisible())
|
|
||||||
{
|
|
||||||
show();
|
|
||||||
showAnimation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::closePopDialog()
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
clearAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::pausePopDialog()
|
|
||||||
{
|
|
||||||
if (animation != NULL)
|
|
||||||
{
|
|
||||||
this->move((desktop.availableGeometry().width() - this->width()),
|
|
||||||
(desktop.availableGeometry().height() - this->height()));
|
|
||||||
animation->setPaused(true);
|
|
||||||
mIsPause = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::startPopDialog()
|
|
||||||
{
|
|
||||||
if (mIsPause)
|
|
||||||
{
|
|
||||||
if (animation != NULL)
|
|
||||||
{
|
|
||||||
animation->setPaused(false);
|
|
||||||
mIsPause = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::closeAnimation()
|
|
||||||
{
|
|
||||||
if (!mIsPause)
|
|
||||||
{
|
|
||||||
remainTimer->stop();
|
|
||||||
disconnect(remainTimer, SIGNAL(timeout()), this, SLOT(closeAnimation()));
|
|
||||||
delete remainTimer;
|
|
||||||
remainTimer = NULL;
|
|
||||||
animation->setStartValue(QPoint(this->x(), this->y()));
|
|
||||||
animation->setEndValue(QPoint((desktop.availableGeometry().width() - this->width()),
|
|
||||||
desktop.availableGeometry().height() + 50));
|
|
||||||
animation->start();
|
|
||||||
connect(animation, SIGNAL(finished()), this, SLOT(clearAll()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::clearAll()
|
|
||||||
{
|
|
||||||
if (animation != NULL)
|
|
||||||
{
|
|
||||||
disconnect(animation, SIGNAL(finished()), this, SLOT(clearAll()));
|
|
||||||
delete animation;
|
|
||||||
}
|
|
||||||
|
|
||||||
animation = NULL;
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::showAnimation()
|
|
||||||
{
|
|
||||||
if (!mIsPause)
|
|
||||||
{
|
|
||||||
animation = new QPropertyAnimation(this, "pos");
|
|
||||||
animation->setDuration(mremainTime);
|
|
||||||
animation->setEasingCurve(QEasingCurve::OutElastic);
|
|
||||||
animation->setStartValue(QPoint(this->x(), this->y()));
|
|
||||||
animation->setEndValue(QPoint((desktop.availableGeometry().width() - this->width()),
|
|
||||||
(desktop.availableGeometry().height() - this->height())));
|
|
||||||
connect(animation, SIGNAL(valueChanged(QVariant)), this, SLOT(animationValueChanged(QVariant)));
|
|
||||||
animation->start();
|
|
||||||
remainTimer = new QTimer();
|
|
||||||
connect(remainTimer, SIGNAL(timeout()), this, SLOT(closeAnimation()));
|
|
||||||
remainTimer->start(mremainTime * 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtPopEffectDialog::animationValueChanged(QVariant param_value)
|
|
||||||
{
|
|
||||||
QPoint tempValue = param_value.toPoint();
|
|
||||||
Q_UNUSED(tempValue)
|
|
||||||
}
|
|
102
src/exquisite/qqtpopupdialog.cpp
Normal file
102
src/exquisite/qqtpopupdialog.cpp
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#include "qqtpopupdialog.h"
|
||||||
|
|
||||||
|
QQtPopUpDialog::QQtPopUpDialog ( QWidget* parent ) : QDialog ( parent )
|
||||||
|
{
|
||||||
|
this->setWindowFlags ( Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool );
|
||||||
|
mIsPause = false;
|
||||||
|
remainTimer = NULL;
|
||||||
|
animation = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::showPopDialog ( quint32 paramRemainTime )
|
||||||
|
{
|
||||||
|
mremainTime = paramRemainTime * 500;
|
||||||
|
this->move ( ( desktop.availableGeometry().width() - this->width() ), desktop.availableGeometry().height() );
|
||||||
|
|
||||||
|
if ( !this->isVisible() )
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
showAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::closePopDialog()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
clearAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::pausePopDialog()
|
||||||
|
{
|
||||||
|
if ( animation != NULL )
|
||||||
|
{
|
||||||
|
this->move ( ( desktop.availableGeometry().width() - this->width() ),
|
||||||
|
( desktop.availableGeometry().height() - this->height() ) );
|
||||||
|
animation->setPaused ( true );
|
||||||
|
mIsPause = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::startPopDialog()
|
||||||
|
{
|
||||||
|
if ( mIsPause )
|
||||||
|
{
|
||||||
|
if ( animation != NULL )
|
||||||
|
{
|
||||||
|
animation->setPaused ( false );
|
||||||
|
mIsPause = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::closeAnimation()
|
||||||
|
{
|
||||||
|
if ( !mIsPause )
|
||||||
|
{
|
||||||
|
remainTimer->stop();
|
||||||
|
disconnect ( remainTimer, SIGNAL ( timeout() ), this, SLOT ( closeAnimation() ) );
|
||||||
|
delete remainTimer;
|
||||||
|
remainTimer = NULL;
|
||||||
|
animation->setStartValue ( QPoint ( this->x(), this->y() ) );
|
||||||
|
animation->setEndValue ( QPoint ( ( desktop.availableGeometry().width() - this->width() ),
|
||||||
|
desktop.availableGeometry().height() + 50 ) );
|
||||||
|
animation->start();
|
||||||
|
connect ( animation, SIGNAL ( finished() ), this, SLOT ( clearAll() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::clearAll()
|
||||||
|
{
|
||||||
|
if ( animation != NULL )
|
||||||
|
{
|
||||||
|
disconnect ( animation, SIGNAL ( finished() ), this, SLOT ( clearAll() ) );
|
||||||
|
delete animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
animation = NULL;
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::showAnimation()
|
||||||
|
{
|
||||||
|
if ( !mIsPause )
|
||||||
|
{
|
||||||
|
animation = new QPropertyAnimation ( this, "pos" );
|
||||||
|
animation->setDuration ( mremainTime );
|
||||||
|
animation->setEasingCurve ( QEasingCurve::OutElastic );
|
||||||
|
animation->setStartValue ( QPoint ( this->x(), this->y() ) );
|
||||||
|
animation->setEndValue ( QPoint ( ( desktop.availableGeometry().width() - this->width() ),
|
||||||
|
( desktop.availableGeometry().height() - this->height() ) ) );
|
||||||
|
connect ( animation, SIGNAL ( valueChanged ( QVariant ) ), this, SLOT ( animationValueChanged ( QVariant ) ) );
|
||||||
|
animation->start();
|
||||||
|
remainTimer = new QTimer();
|
||||||
|
connect ( remainTimer, SIGNAL ( timeout() ), this, SLOT ( closeAnimation() ) );
|
||||||
|
remainTimer->start ( mremainTime * 4 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtPopUpDialog::animationValueChanged ( QVariant param_value )
|
||||||
|
{
|
||||||
|
QPoint tempValue = param_value.toPoint();
|
||||||
|
Q_UNUSED ( tempValue )
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTPOPEFFECTDIALOG_H
|
#ifndef QQTPOPUPDIALOG_H
|
||||||
#define QQTPOPEFFECTDIALOG_H
|
#define QQTPOPUPDIALOG_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) 2017年10月22日18:01:48
|
* T.D.R (QQ:2657635903) 2017年10月22日18:01:48
|
||||||
@ -22,25 +22,25 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtPopEffectDialog class 弹出窗体界面
|
* @brief The QQtPopUpDialog class 弹出窗体界面
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtPopEffectDialog : public QDialog
|
class QQTSHARED_EXPORT QQtPopUpDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief QQtPopEffectDialog 构造函数
|
* @brief QQtPopUpDialog 构造函数
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
explicit QQtPopEffectDialog(QWidget* parent = 0);
|
explicit QQtPopUpDialog ( QWidget* parent = 0 );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief showPopDialog 显示弹出窗口
|
* @brief showPopDialog 显示弹出窗口
|
||||||
* @param paramRemainTime
|
* @param paramRemainTime
|
||||||
*/
|
*/
|
||||||
void showPopDialog(quint32 paramRemainTime = 6);
|
void showPopDialog ( quint32 paramRemainTime = 6 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief closePopDialog 关闭弹出窗口
|
* @brief closePopDialog 关闭弹出窗口
|
||||||
@ -78,7 +78,7 @@ private slots:
|
|||||||
* @brief animationValueChanged 属性值发生改变时的槽函数
|
* @brief animationValueChanged 属性值发生改变时的槽函数
|
||||||
* @param param_value
|
* @param param_value
|
||||||
*/
|
*/
|
||||||
void animationValueChanged(QVariant param_value);
|
void animationValueChanged ( QVariant param_value );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -110,4 +110,4 @@ private:
|
|||||||
bool mIsPause;
|
bool mIsPause;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTPOPEFFECTDIALOG_H
|
#endif // QQTPOPUPDIALOG_H
|
@ -1,72 +0,0 @@
|
|||||||
#include "qqtrippleeffectpushbutton.h"
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
|
|
||||||
QQtRippleEffectPushButton::QQtRippleEffectPushButton(QWidget* parent)
|
|
||||||
: QPushButton(parent)
|
|
||||||
, pointX(0)
|
|
||||||
, pointY(0)
|
|
||||||
, waveRadius(0)
|
|
||||||
{
|
|
||||||
setClickColor(QColor(Qt::lightGray));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRippleEffectPushButton::paintEvent(QPaintEvent* event)
|
|
||||||
{
|
|
||||||
if (waveRadius < (width() > height() ? width() : height()) * 2)
|
|
||||||
{
|
|
||||||
// 主圆圈
|
|
||||||
QPainter tempPainter;
|
|
||||||
tempPainter.begin(this);
|
|
||||||
QBrush tempBrush;
|
|
||||||
tempBrush.setStyle(Qt::SolidPattern);
|
|
||||||
tempBrush.setColor(getClickColor());
|
|
||||||
tempPainter.setBrush(tempBrush);
|
|
||||||
QPen tempPen;
|
|
||||||
tempPen.setColor(getClickColor());
|
|
||||||
tempPen.setJoinStyle(Qt::RoundJoin);
|
|
||||||
tempPen.setCapStyle(Qt::FlatCap);
|
|
||||||
tempPainter.setPen(tempPen);
|
|
||||||
tempPainter.setRenderHint(QPainter::HighQualityAntialiasing);
|
|
||||||
tempPainter.setOpacity(0.7);
|
|
||||||
QRectF rectangle(pointX - waveRadius / 2, pointY - waveRadius / 2, waveRadius, waveRadius);
|
|
||||||
tempPainter.drawEllipse(rectangle);
|
|
||||||
tempPainter.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget::paintEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRippleEffectPushButton::mousePressEvent(QMouseEvent* event)
|
|
||||||
{
|
|
||||||
pointX = event->x();
|
|
||||||
pointY = event->y();
|
|
||||||
QPropertyAnimation* animation = new QPropertyAnimation(this, "waveRadius");
|
|
||||||
animation->setDuration(400);
|
|
||||||
animation->setStartValue(0);
|
|
||||||
animation->setEndValue((width() > height() ? width() : height()) * 2);
|
|
||||||
animation->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor QQtRippleEffectPushButton::getClickColor() const
|
|
||||||
{
|
|
||||||
return clickColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRippleEffectPushButton::setClickColor(const QColor& value)
|
|
||||||
{
|
|
||||||
clickColor = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal QQtRippleEffectPushButton::getWaveRadius() const
|
|
||||||
{
|
|
||||||
return waveRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRippleEffectPushButton::setWaveRadius(const qreal& value)
|
|
||||||
{
|
|
||||||
waveRadius = value;
|
|
||||||
emit waveRadiusChanged(value);
|
|
||||||
update();
|
|
||||||
}
|
|
72
src/exquisite/qqtripplepushbutton.cpp
Normal file
72
src/exquisite/qqtripplepushbutton.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include "qqtripplepushbutton.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
|
QQtRipplePushButton::QQtRipplePushButton ( QWidget* parent )
|
||||||
|
: QPushButton ( parent )
|
||||||
|
, pointX ( 0 )
|
||||||
|
, pointY ( 0 )
|
||||||
|
, waveRadius ( 0 )
|
||||||
|
{
|
||||||
|
setClickColor ( QColor ( Qt::lightGray ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRipplePushButton::paintEvent ( QPaintEvent* event )
|
||||||
|
{
|
||||||
|
if ( waveRadius < ( width() > height() ? width() : height() ) * 2 )
|
||||||
|
{
|
||||||
|
// 主圆圈
|
||||||
|
QPainter tempPainter;
|
||||||
|
tempPainter.begin ( this );
|
||||||
|
QBrush tempBrush;
|
||||||
|
tempBrush.setStyle ( Qt::SolidPattern );
|
||||||
|
tempBrush.setColor ( getClickColor() );
|
||||||
|
tempPainter.setBrush ( tempBrush );
|
||||||
|
QPen tempPen;
|
||||||
|
tempPen.setColor ( getClickColor() );
|
||||||
|
tempPen.setJoinStyle ( Qt::RoundJoin );
|
||||||
|
tempPen.setCapStyle ( Qt::FlatCap );
|
||||||
|
tempPainter.setPen ( tempPen );
|
||||||
|
tempPainter.setRenderHint ( QPainter::HighQualityAntialiasing );
|
||||||
|
tempPainter.setOpacity ( 0.7 );
|
||||||
|
QRectF rectangle ( pointX - waveRadius / 2, pointY - waveRadius / 2, waveRadius, waveRadius );
|
||||||
|
tempPainter.drawEllipse ( rectangle );
|
||||||
|
tempPainter.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget::paintEvent ( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRipplePushButton::mousePressEvent ( QMouseEvent* event )
|
||||||
|
{
|
||||||
|
pointX = event->x();
|
||||||
|
pointY = event->y();
|
||||||
|
QPropertyAnimation* animation = new QPropertyAnimation ( this, "waveRadius" );
|
||||||
|
animation->setDuration ( 400 );
|
||||||
|
animation->setStartValue ( 0 );
|
||||||
|
animation->setEndValue ( ( width() > height() ? width() : height() ) * 2 );
|
||||||
|
animation->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor QQtRipplePushButton::getClickColor() const
|
||||||
|
{
|
||||||
|
return clickColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRipplePushButton::setClickColor ( const QColor& value )
|
||||||
|
{
|
||||||
|
clickColor = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal QQtRipplePushButton::getWaveRadius() const
|
||||||
|
{
|
||||||
|
return waveRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRipplePushButton::setWaveRadius ( const qreal& value )
|
||||||
|
{
|
||||||
|
waveRadius = value;
|
||||||
|
emit waveRadiusChanged ( value );
|
||||||
|
update();
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTRIPPLEEFFECTPUSHBUTTON_H
|
#ifndef QQTRIPPLEPUSHBUTTON_H
|
||||||
#define QQTRIPPLEEFFECTPUSHBUTTON_H
|
#define QQTRIPPLEPUSHBUTTON_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* T.D.R (QQ:2657635903) mod 2017年10月22日16:12:22
|
* T.D.R (QQ:2657635903) mod 2017年10月22日16:12:22
|
||||||
@ -18,19 +18,19 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtCustomRipplePushButton class 点击波按钮
|
* @brief The QQtRipplePushButton class 点击波按钮
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtRippleEffectPushButton : public QPushButton
|
class QQTSHARED_EXPORT QQtRipplePushButton : public QPushButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(qreal waveRadius READ getWaveRadius WRITE setWaveRadius NOTIFY waveRadiusChanged)
|
Q_PROPERTY ( qreal waveRadius READ getWaveRadius WRITE setWaveRadius NOTIFY waveRadiusChanged )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief NBaseClickWave 构造函数
|
* @brief NBaseClickWave 构造函数
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
explicit QQtRippleEffectPushButton(QWidget* parent = 0);
|
explicit QQtRipplePushButton ( QWidget* parent = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getWaveRadius 获取圆周半径
|
* @brief getWaveRadius 获取圆周半径
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
* @brief setWaveRadius 设置圆周半径
|
* @brief setWaveRadius 设置圆周半径
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
void setWaveRadius(const qreal& value);
|
void setWaveRadius ( const qreal& value );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getClickColor 获取点击波颜色
|
* @brief getClickColor 获取点击波颜色
|
||||||
@ -54,26 +54,26 @@ public:
|
|||||||
* @brief setClickColor 设置点击波颜色
|
* @brief setClickColor 设置点击波颜色
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
void setClickColor(const QColor& value);
|
void setClickColor ( const QColor& value );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief waveRadiusChanged 点击波改变
|
* @brief waveRadiusChanged 点击波改变
|
||||||
*/
|
*/
|
||||||
void waveRadiusChanged(qreal waveRadius);
|
void waveRadiusChanged ( qreal waveRadius );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief paintEvent 绘制事件
|
* @brief paintEvent 绘制事件
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
void paintEvent(QPaintEvent* event);
|
void paintEvent ( QPaintEvent* event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mousePressEvent 鼠标按压事件
|
* @brief mousePressEvent 鼠标按压事件
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent ( QMouseEvent* event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -97,4 +97,4 @@ private:
|
|||||||
QColor clickColor;
|
QColor clickColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTRIPPLEEFFECTPUSHBUTTON_H
|
#endif // QQTRIPPLEPUSHBUTTON_H
|
@ -1,344 +0,0 @@
|
|||||||
#include "qqtrulereffectslider.h"
|
|
||||||
#include "qpainter.h"
|
|
||||||
#include "qevent.h"
|
|
||||||
#include "qtimer.h"
|
|
||||||
#include "qdebug.h"
|
|
||||||
|
|
||||||
QQtRulerEffectSlider::QQtRulerEffectSlider(QWidget* parent) :
|
|
||||||
QSlider(parent)
|
|
||||||
{
|
|
||||||
value = 0.0;
|
|
||||||
minValue = 0.0;
|
|
||||||
maxValue = 100.0;
|
|
||||||
|
|
||||||
precision = 0;
|
|
||||||
longStep = 10;
|
|
||||||
shortStep = 1;
|
|
||||||
space = 20;
|
|
||||||
|
|
||||||
bgColorStart = QColor(100, 100, 100);
|
|
||||||
bgColorEnd = QColor(60, 60, 60);
|
|
||||||
lineColor = QColor(255, 255, 255);
|
|
||||||
|
|
||||||
sliderColorTop = QColor(100, 184, 255);
|
|
||||||
sliderColorBottom = QColor(235, 235, 235);
|
|
||||||
|
|
||||||
tipBgColor = QColor(255, 255, 255);
|
|
||||||
tipTextColor = QColor(50, 50, 50);
|
|
||||||
|
|
||||||
pressed = false;
|
|
||||||
currentValue = 0;
|
|
||||||
sliderLastPot = QPointF(space, longLineHeight / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::resizeEvent(QResizeEvent*)
|
|
||||||
{
|
|
||||||
resetVariables();
|
|
||||||
setValue(currentValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::wheelEvent(QWheelEvent* e)
|
|
||||||
{
|
|
||||||
/*滚动的角度,*8就是鼠标滚动的距离*/
|
|
||||||
int degrees = e->delta() / 8;
|
|
||||||
|
|
||||||
/*滚动的步数,*15就是鼠标滚动的角度*/
|
|
||||||
int steps = degrees / 15;
|
|
||||||
|
|
||||||
/*如果是正数代表为左边移动,负数代表为右边移动*/
|
|
||||||
if (e->orientation() == Qt::Vertical)
|
|
||||||
{
|
|
||||||
double value = currentValue - steps;
|
|
||||||
|
|
||||||
if (steps > 0)
|
|
||||||
{
|
|
||||||
if (value > minValue)
|
|
||||||
{
|
|
||||||
setValue(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setValue(minValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (value < maxValue)
|
|
||||||
{
|
|
||||||
setValue(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setValue(maxValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::mousePressEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
if (e->button() & Qt::LeftButton)
|
|
||||||
{
|
|
||||||
if (sliderRect.contains(e->pos()))
|
|
||||||
{
|
|
||||||
pressed = true;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::mouseReleaseEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
pressed = false;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::mouseMoveEvent(QMouseEvent* e)
|
|
||||||
{
|
|
||||||
if (pressed)
|
|
||||||
{
|
|
||||||
if (e->pos().x() >= lineLeftPot.x() && e->pos().x() <= lineRightPot.x())
|
|
||||||
{
|
|
||||||
double totalLineWidth = lineRightPot.x() - lineLeftPot.x();
|
|
||||||
double dx = e->pos().x() - lineLeftPot.x();
|
|
||||||
double ratio = (double)dx / totalLineWidth;
|
|
||||||
sliderLastPot = QPointF(e->pos().x(), sliderTopPot.y());
|
|
||||||
|
|
||||||
currentValue = (maxValue - minValue) * ratio + minValue;
|
|
||||||
this->value = currentValue;
|
|
||||||
emit valueChanged(currentValue);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::paintEvent(QPaintEvent*)
|
|
||||||
{
|
|
||||||
/*绘制准备工作,启用反锯齿*/
|
|
||||||
QPainter painter(this);
|
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
|
||||||
|
|
||||||
/*绘制背景*/
|
|
||||||
drawBg(&painter);
|
|
||||||
/*绘制标尺*/
|
|
||||||
drawRule(&painter);
|
|
||||||
/*绘制滑块*/
|
|
||||||
drawSlider(&painter);
|
|
||||||
/*绘制当前值的提示*/
|
|
||||||
drawTip(&painter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::drawBg(QPainter* painter)
|
|
||||||
{
|
|
||||||
painter->save();
|
|
||||||
painter->setPen(Qt::NoPen);
|
|
||||||
QLinearGradient bgGradient(0, 0, 0, height());
|
|
||||||
bgGradient.setColorAt(0.0, bgColorStart);
|
|
||||||
bgGradient.setColorAt(1.0, bgColorEnd);
|
|
||||||
painter->setBrush(bgGradient);
|
|
||||||
painter->drawRect(rect());
|
|
||||||
painter->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::drawRule(QPainter* painter)
|
|
||||||
{
|
|
||||||
painter->save();
|
|
||||||
painter->setPen(lineColor);
|
|
||||||
|
|
||||||
/*绘制横向标尺底部线,居中*/
|
|
||||||
double initX = space;
|
|
||||||
double initY = (double)height() / 2;
|
|
||||||
lineLeftPot = QPointF(initX, initY);
|
|
||||||
lineRightPot = QPointF(width() - initX, initY);
|
|
||||||
painter->drawLine(lineLeftPot, lineRightPot);
|
|
||||||
|
|
||||||
/*绘制纵向标尺刻度 */
|
|
||||||
double length = width() - 2 * space;
|
|
||||||
/*计算每一格移动多少*/
|
|
||||||
double increment = length / (maxValue - minValue);
|
|
||||||
|
|
||||||
/*根据范围值绘制刻度值及刻度值*/
|
|
||||||
for (int i = minValue; i <= maxValue; i = i + shortStep)
|
|
||||||
{
|
|
||||||
if (i % longStep == 0)
|
|
||||||
{
|
|
||||||
QPointF topPot(initX, initY - longLineHeight);
|
|
||||||
QPointF bottomPot(initX, initY);
|
|
||||||
painter->drawLine(topPot, bottomPot);
|
|
||||||
|
|
||||||
QString strValue = QString("%1").arg((double)i, 0, 'f', precision);
|
|
||||||
double textWidth = fontMetrics().width(strValue);
|
|
||||||
double textHeight = fontMetrics().height();
|
|
||||||
QPointF textPot(initX - textWidth / 2, initY + textHeight);
|
|
||||||
painter->drawText(textPot, strValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QPointF topPot(initX, initY - shortLineHeight);
|
|
||||||
QPointF bottomPot(initX, initY);
|
|
||||||
painter->drawLine(topPot, bottomPot);
|
|
||||||
}
|
|
||||||
|
|
||||||
initX += increment * shortStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
painter->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::drawSlider(QPainter* painter)
|
|
||||||
{
|
|
||||||
painter->save();
|
|
||||||
|
|
||||||
/*绘制滑块上部分三角形*/
|
|
||||||
sliderTopPot = QPointF(sliderLastPot.x(), lineLeftPot.y() - longLineHeight / 4);
|
|
||||||
sliderLeftPot = QPointF(sliderTopPot.x() - width() / 100, sliderTopPot.y() + sliderTopHeight);
|
|
||||||
sliderRightPot = QPointF(sliderTopPot.x() + width() / 100, sliderTopPot.y() + sliderTopHeight);
|
|
||||||
|
|
||||||
painter->setPen(sliderColorTop);
|
|
||||||
painter->setBrush(sliderColorTop);
|
|
||||||
|
|
||||||
QVector<QPointF> potVec;
|
|
||||||
potVec.append(sliderTopPot);
|
|
||||||
potVec.append(sliderLeftPot);
|
|
||||||
potVec.append(sliderRightPot);
|
|
||||||
painter->drawPolygon(potVec);
|
|
||||||
|
|
||||||
/*绘制滑块下部分矩形*/
|
|
||||||
double indicatorLength = sliderRightPot.x() - sliderLeftPot.x();
|
|
||||||
|
|
||||||
QPointF handleBottomRightPot(sliderLeftPot.x() + indicatorLength, sliderLeftPot.y() + sliderBottomHeight);
|
|
||||||
sliderRect = QRectF(sliderLeftPot, handleBottomRightPot);
|
|
||||||
|
|
||||||
QPointF tipRectTopLeftPot(sliderRect.topRight().x() + 2, sliderRect.topRight().y());
|
|
||||||
QString strValue = QString("%1").arg(currentValue, 0, 'f', precision);
|
|
||||||
|
|
||||||
double textLength = fontMetrics().width(strValue);
|
|
||||||
double textHeight = fontMetrics().height();
|
|
||||||
QPointF tipRectBottomRightPot(tipRectTopLeftPot.x() + textLength + 10, tipRectTopLeftPot.y() + textHeight + 5);
|
|
||||||
tipRect = QRectF(tipRectTopLeftPot, tipRectBottomRightPot);
|
|
||||||
|
|
||||||
painter->setPen(sliderColorBottom);
|
|
||||||
painter->setBrush(sliderColorBottom);
|
|
||||||
painter->drawRect(sliderRect);
|
|
||||||
painter->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::drawTip(QPainter* painter)
|
|
||||||
{
|
|
||||||
if (!pressed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
painter->save();
|
|
||||||
painter->setPen(tipTextColor);
|
|
||||||
painter->setBrush(tipBgColor);
|
|
||||||
painter->drawRect(tipRect);
|
|
||||||
QString strValue = QString("%1").arg(currentValue, 0, 'f', precision);
|
|
||||||
painter->drawText(tipRect, Qt::AlignCenter, strValue);
|
|
||||||
painter->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::resetVariables()
|
|
||||||
{
|
|
||||||
longLineHeight = height() / 5;
|
|
||||||
shortLineHeight = height() / 7;
|
|
||||||
sliderTopHeight = height() / 7;
|
|
||||||
sliderBottomHeight = height() / 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setRange(double minValue, double maxValue)
|
|
||||||
{
|
|
||||||
/*如果最小值大于或者等于最大值以及最小值小于0则不设置*/
|
|
||||||
if (minValue >= maxValue || minValue < 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->minValue = minValue;
|
|
||||||
this->maxValue = maxValue;
|
|
||||||
setValue(minValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setRange(int minValue, int maxValue)
|
|
||||||
{
|
|
||||||
setRange((double)minValue, (double)maxValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setValue(double value)
|
|
||||||
{
|
|
||||||
/*值小于最小值或者值大于最大值则无需处理*/
|
|
||||||
if (value < minValue || value > maxValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double lineWidth = width() - 2 * space;
|
|
||||||
double ratio = (double)value / (maxValue - minValue);
|
|
||||||
double x = lineWidth * ratio;
|
|
||||||
double newX = x + space;
|
|
||||||
double y = space + longLineHeight - 10;
|
|
||||||
sliderLastPot = QPointF(newX, y);
|
|
||||||
|
|
||||||
this->value = value;
|
|
||||||
this->currentValue = value;
|
|
||||||
emit valueChanged(value);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setValue(int value)
|
|
||||||
{
|
|
||||||
setValue((double)value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setPrecision(int precision)
|
|
||||||
{
|
|
||||||
this->precision = precision;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setStep(int longStep, int shortStep)
|
|
||||||
{
|
|
||||||
/*短步长不能超过长步长*/
|
|
||||||
if (longStep < shortStep)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->longStep = longStep;
|
|
||||||
this->shortStep = shortStep;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setSpace(int space)
|
|
||||||
{
|
|
||||||
this->space = space;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setBgColor(QColor bgColorStart, QColor bgColorEnd)
|
|
||||||
{
|
|
||||||
this->bgColorStart = bgColorStart;
|
|
||||||
this->bgColorEnd = bgColorEnd;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setLineColor(QColor lineColor)
|
|
||||||
{
|
|
||||||
this->lineColor = lineColor;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setSliderColor(QColor sliderColorTop, QColor sliderColorBottom)
|
|
||||||
{
|
|
||||||
this->sliderColorTop = sliderColorTop;
|
|
||||||
this->sliderColorBottom = sliderColorBottom;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtRulerEffectSlider::setTipBgColor(QColor tipBgColor, QColor tipTextColor)
|
|
||||||
{
|
|
||||||
this->tipBgColor = tipBgColor;
|
|
||||||
this->tipTextColor = tipTextColor;
|
|
||||||
update();
|
|
||||||
}
|
|
344
src/exquisite/qqtrulerslider.cpp
Normal file
344
src/exquisite/qqtrulerslider.cpp
Normal file
@ -0,0 +1,344 @@
|
|||||||
|
#include "qqtrulerslider.h"
|
||||||
|
#include "qpainter.h"
|
||||||
|
#include "qevent.h"
|
||||||
|
#include "qtimer.h"
|
||||||
|
#include "qdebug.h"
|
||||||
|
|
||||||
|
QQtRulerSlider::QQtRulerSlider ( QWidget* parent ) :
|
||||||
|
QSlider ( parent )
|
||||||
|
{
|
||||||
|
value = 0.0;
|
||||||
|
minValue = 0.0;
|
||||||
|
maxValue = 100.0;
|
||||||
|
|
||||||
|
precision = 0;
|
||||||
|
longStep = 10;
|
||||||
|
shortStep = 1;
|
||||||
|
space = 20;
|
||||||
|
|
||||||
|
bgColorStart = QColor ( 100, 100, 100 );
|
||||||
|
bgColorEnd = QColor ( 60, 60, 60 );
|
||||||
|
lineColor = QColor ( 255, 255, 255 );
|
||||||
|
|
||||||
|
sliderColorTop = QColor ( 100, 184, 255 );
|
||||||
|
sliderColorBottom = QColor ( 235, 235, 235 );
|
||||||
|
|
||||||
|
tipBgColor = QColor ( 255, 255, 255 );
|
||||||
|
tipTextColor = QColor ( 50, 50, 50 );
|
||||||
|
|
||||||
|
pressed = false;
|
||||||
|
currentValue = 0;
|
||||||
|
sliderLastPot = QPointF ( space, longLineHeight / 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::resizeEvent ( QResizeEvent* )
|
||||||
|
{
|
||||||
|
resetVariables();
|
||||||
|
setValue ( currentValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::wheelEvent ( QWheelEvent* e )
|
||||||
|
{
|
||||||
|
/*滚动的角度,*8就是鼠标滚动的距离*/
|
||||||
|
int degrees = e->delta() / 8;
|
||||||
|
|
||||||
|
/*滚动的步数,*15就是鼠标滚动的角度*/
|
||||||
|
int steps = degrees / 15;
|
||||||
|
|
||||||
|
/*如果是正数代表为左边移动,负数代表为右边移动*/
|
||||||
|
if ( e->orientation() == Qt::Vertical )
|
||||||
|
{
|
||||||
|
double value = currentValue - steps;
|
||||||
|
|
||||||
|
if ( steps > 0 )
|
||||||
|
{
|
||||||
|
if ( value > minValue )
|
||||||
|
{
|
||||||
|
setValue ( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setValue ( minValue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( value < maxValue )
|
||||||
|
{
|
||||||
|
setValue ( value );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setValue ( maxValue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::mousePressEvent ( QMouseEvent* e )
|
||||||
|
{
|
||||||
|
if ( e->button() & Qt::LeftButton )
|
||||||
|
{
|
||||||
|
if ( sliderRect.contains ( e->pos() ) )
|
||||||
|
{
|
||||||
|
pressed = true;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::mouseReleaseEvent ( QMouseEvent* e )
|
||||||
|
{
|
||||||
|
pressed = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::mouseMoveEvent ( QMouseEvent* e )
|
||||||
|
{
|
||||||
|
if ( pressed )
|
||||||
|
{
|
||||||
|
if ( e->pos().x() >= lineLeftPot.x() && e->pos().x() <= lineRightPot.x() )
|
||||||
|
{
|
||||||
|
double totalLineWidth = lineRightPot.x() - lineLeftPot.x();
|
||||||
|
double dx = e->pos().x() - lineLeftPot.x();
|
||||||
|
double ratio = ( double ) dx / totalLineWidth;
|
||||||
|
sliderLastPot = QPointF ( e->pos().x(), sliderTopPot.y() );
|
||||||
|
|
||||||
|
currentValue = ( maxValue - minValue ) * ratio + minValue;
|
||||||
|
this->value = currentValue;
|
||||||
|
emit valueChanged ( currentValue );
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::paintEvent ( QPaintEvent* )
|
||||||
|
{
|
||||||
|
/*绘制准备工作,启用反锯齿*/
|
||||||
|
QPainter painter ( this );
|
||||||
|
painter.setRenderHint ( QPainter::Antialiasing );
|
||||||
|
|
||||||
|
/*绘制背景*/
|
||||||
|
drawBg ( &painter );
|
||||||
|
/*绘制标尺*/
|
||||||
|
drawRule ( &painter );
|
||||||
|
/*绘制滑块*/
|
||||||
|
drawSlider ( &painter );
|
||||||
|
/*绘制当前值的提示*/
|
||||||
|
drawTip ( &painter );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::drawBg ( QPainter* painter )
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
painter->setPen ( Qt::NoPen );
|
||||||
|
QLinearGradient bgGradient ( 0, 0, 0, height() );
|
||||||
|
bgGradient.setColorAt ( 0.0, bgColorStart );
|
||||||
|
bgGradient.setColorAt ( 1.0, bgColorEnd );
|
||||||
|
painter->setBrush ( bgGradient );
|
||||||
|
painter->drawRect ( rect() );
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::drawRule ( QPainter* painter )
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
painter->setPen ( lineColor );
|
||||||
|
|
||||||
|
/*绘制横向标尺底部线,居中*/
|
||||||
|
double initX = space;
|
||||||
|
double initY = ( double ) height() / 2;
|
||||||
|
lineLeftPot = QPointF ( initX, initY );
|
||||||
|
lineRightPot = QPointF ( width() - initX, initY );
|
||||||
|
painter->drawLine ( lineLeftPot, lineRightPot );
|
||||||
|
|
||||||
|
/*绘制纵向标尺刻度 */
|
||||||
|
double length = width() - 2 * space;
|
||||||
|
/*计算每一格移动多少*/
|
||||||
|
double increment = length / ( maxValue - minValue );
|
||||||
|
|
||||||
|
/*根据范围值绘制刻度值及刻度值*/
|
||||||
|
for ( int i = minValue; i <= maxValue; i = i + shortStep )
|
||||||
|
{
|
||||||
|
if ( i % longStep == 0 )
|
||||||
|
{
|
||||||
|
QPointF topPot ( initX, initY - longLineHeight );
|
||||||
|
QPointF bottomPot ( initX, initY );
|
||||||
|
painter->drawLine ( topPot, bottomPot );
|
||||||
|
|
||||||
|
QString strValue = QString ( "%1" ).arg ( ( double ) i, 0, 'f', precision );
|
||||||
|
double textWidth = fontMetrics().width ( strValue );
|
||||||
|
double textHeight = fontMetrics().height();
|
||||||
|
QPointF textPot ( initX - textWidth / 2, initY + textHeight );
|
||||||
|
painter->drawText ( textPot, strValue );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QPointF topPot ( initX, initY - shortLineHeight );
|
||||||
|
QPointF bottomPot ( initX, initY );
|
||||||
|
painter->drawLine ( topPot, bottomPot );
|
||||||
|
}
|
||||||
|
|
||||||
|
initX += increment * shortStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::drawSlider ( QPainter* painter )
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
|
||||||
|
/*绘制滑块上部分三角形*/
|
||||||
|
sliderTopPot = QPointF ( sliderLastPot.x(), lineLeftPot.y() - longLineHeight / 4 );
|
||||||
|
sliderLeftPot = QPointF ( sliderTopPot.x() - width() / 100, sliderTopPot.y() + sliderTopHeight );
|
||||||
|
sliderRightPot = QPointF ( sliderTopPot.x() + width() / 100, sliderTopPot.y() + sliderTopHeight );
|
||||||
|
|
||||||
|
painter->setPen ( sliderColorTop );
|
||||||
|
painter->setBrush ( sliderColorTop );
|
||||||
|
|
||||||
|
QVector<QPointF> potVec;
|
||||||
|
potVec.append ( sliderTopPot );
|
||||||
|
potVec.append ( sliderLeftPot );
|
||||||
|
potVec.append ( sliderRightPot );
|
||||||
|
painter->drawPolygon ( potVec );
|
||||||
|
|
||||||
|
/*绘制滑块下部分矩形*/
|
||||||
|
double indicatorLength = sliderRightPot.x() - sliderLeftPot.x();
|
||||||
|
|
||||||
|
QPointF handleBottomRightPot ( sliderLeftPot.x() + indicatorLength, sliderLeftPot.y() + sliderBottomHeight );
|
||||||
|
sliderRect = QRectF ( sliderLeftPot, handleBottomRightPot );
|
||||||
|
|
||||||
|
QPointF tipRectTopLeftPot ( sliderRect.topRight().x() + 2, sliderRect.topRight().y() );
|
||||||
|
QString strValue = QString ( "%1" ).arg ( currentValue, 0, 'f', precision );
|
||||||
|
|
||||||
|
double textLength = fontMetrics().width ( strValue );
|
||||||
|
double textHeight = fontMetrics().height();
|
||||||
|
QPointF tipRectBottomRightPot ( tipRectTopLeftPot.x() + textLength + 10, tipRectTopLeftPot.y() + textHeight + 5 );
|
||||||
|
tipRect = QRectF ( tipRectTopLeftPot, tipRectBottomRightPot );
|
||||||
|
|
||||||
|
painter->setPen ( sliderColorBottom );
|
||||||
|
painter->setBrush ( sliderColorBottom );
|
||||||
|
painter->drawRect ( sliderRect );
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::drawTip ( QPainter* painter )
|
||||||
|
{
|
||||||
|
if ( !pressed )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->save();
|
||||||
|
painter->setPen ( tipTextColor );
|
||||||
|
painter->setBrush ( tipBgColor );
|
||||||
|
painter->drawRect ( tipRect );
|
||||||
|
QString strValue = QString ( "%1" ).arg ( currentValue, 0, 'f', precision );
|
||||||
|
painter->drawText ( tipRect, Qt::AlignCenter, strValue );
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::resetVariables()
|
||||||
|
{
|
||||||
|
longLineHeight = height() / 5;
|
||||||
|
shortLineHeight = height() / 7;
|
||||||
|
sliderTopHeight = height() / 7;
|
||||||
|
sliderBottomHeight = height() / 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setRange ( double minValue, double maxValue )
|
||||||
|
{
|
||||||
|
/*如果最小值大于或者等于最大值以及最小值小于0则不设置*/
|
||||||
|
if ( minValue >= maxValue || minValue < 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->minValue = minValue;
|
||||||
|
this->maxValue = maxValue;
|
||||||
|
setValue ( minValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setRange ( int minValue, int maxValue )
|
||||||
|
{
|
||||||
|
setRange ( ( double ) minValue, ( double ) maxValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setValue ( double value )
|
||||||
|
{
|
||||||
|
/*值小于最小值或者值大于最大值则无需处理*/
|
||||||
|
if ( value < minValue || value > maxValue )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double lineWidth = width() - 2 * space;
|
||||||
|
double ratio = ( double ) value / ( maxValue - minValue );
|
||||||
|
double x = lineWidth * ratio;
|
||||||
|
double newX = x + space;
|
||||||
|
double y = space + longLineHeight - 10;
|
||||||
|
sliderLastPot = QPointF ( newX, y );
|
||||||
|
|
||||||
|
this->value = value;
|
||||||
|
this->currentValue = value;
|
||||||
|
emit valueChanged ( value );
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setValue ( int value )
|
||||||
|
{
|
||||||
|
setValue ( ( double ) value );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setPrecision ( int precision )
|
||||||
|
{
|
||||||
|
this->precision = precision;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setStep ( int longStep, int shortStep )
|
||||||
|
{
|
||||||
|
/*短步长不能超过长步长*/
|
||||||
|
if ( longStep < shortStep )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->longStep = longStep;
|
||||||
|
this->shortStep = shortStep;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setSpace ( int space )
|
||||||
|
{
|
||||||
|
this->space = space;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setBgColor ( QColor bgColorStart, QColor bgColorEnd )
|
||||||
|
{
|
||||||
|
this->bgColorStart = bgColorStart;
|
||||||
|
this->bgColorEnd = bgColorEnd;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setLineColor ( QColor lineColor )
|
||||||
|
{
|
||||||
|
this->lineColor = lineColor;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setSliderColor ( QColor sliderColorTop, QColor sliderColorBottom )
|
||||||
|
{
|
||||||
|
this->sliderColorTop = sliderColorTop;
|
||||||
|
this->sliderColorBottom = sliderColorBottom;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QQtRulerSlider::setTipBgColor ( QColor tipBgColor, QColor tipTextColor )
|
||||||
|
{
|
||||||
|
this->tipBgColor = tipBgColor;
|
||||||
|
this->tipTextColor = tipTextColor;
|
||||||
|
update();
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
#ifndef QQTRULEREFFECTSLIDER_H
|
#ifndef QQTRULERSLIDER_H
|
||||||
#define QQTRULEREFFECTSLIDER_H
|
#define QQTRULERSLIDER_H
|
||||||
|
|
||||||
|
#include <QSlider>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) MOD 2017年10月21日13:24:03
|
* T.D.R (QQ:2657635903) MOD 2017年10月21日13:24:03
|
||||||
@ -17,24 +19,23 @@
|
|||||||
* 7:暂不支持负数刻度值
|
* 7:暂不支持负数刻度值
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QSlider>
|
class QQtRulerSlider : public QSlider
|
||||||
class QQtRulerEffectSlider : public QSlider
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtRulerEffectSlider(QWidget* parent = 0);
|
explicit QQtRulerSlider ( QWidget* parent = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent*);
|
void resizeEvent ( QResizeEvent* );
|
||||||
void wheelEvent(QWheelEvent*);
|
void wheelEvent ( QWheelEvent* );
|
||||||
void mousePressEvent(QMouseEvent*);
|
void mousePressEvent ( QMouseEvent* );
|
||||||
void mouseReleaseEvent(QMouseEvent*);
|
void mouseReleaseEvent ( QMouseEvent* );
|
||||||
void mouseMoveEvent(QMouseEvent*);
|
void mouseMoveEvent ( QMouseEvent* );
|
||||||
void paintEvent(QPaintEvent*);
|
void paintEvent ( QPaintEvent* );
|
||||||
void drawBg(QPainter* painter);
|
void drawBg ( QPainter* painter );
|
||||||
void drawRule(QPainter* painter);
|
void drawRule ( QPainter* painter );
|
||||||
void drawSlider(QPainter* painter);
|
void drawSlider ( QPainter* painter );
|
||||||
void drawTip(QPainter* painter);
|
void drawTip ( QPainter* painter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double value; /*目标值*/
|
double value; /*目标值*/
|
||||||
@ -125,31 +126,31 @@ public:
|
|||||||
}
|
}
|
||||||
public slots:
|
public slots:
|
||||||
/*设置最大最小值-范围值*/
|
/*设置最大最小值-范围值*/
|
||||||
void setRange(double minValue, double maxValue);
|
void setRange ( double minValue, double maxValue );
|
||||||
void setRange(int minValue, int maxValue);
|
void setRange ( int minValue, int maxValue );
|
||||||
|
|
||||||
/*设置目标值*/
|
/*设置目标值*/
|
||||||
void setValue(double value);
|
void setValue ( double value );
|
||||||
void setValue(int value);
|
void setValue ( int value );
|
||||||
|
|
||||||
/*设置精确度*/
|
/*设置精确度*/
|
||||||
void setPrecision(int precision);
|
void setPrecision ( int precision );
|
||||||
/*设置线条等分步长*/
|
/*设置线条等分步长*/
|
||||||
void setStep(int longStep, int shortStep);
|
void setStep ( int longStep, int shortStep );
|
||||||
/*设置间距*/
|
/*设置间距*/
|
||||||
void setSpace(int space);
|
void setSpace ( int space );
|
||||||
|
|
||||||
/*设置背景颜色*/
|
/*设置背景颜色*/
|
||||||
void setBgColor(QColor bgColorStart, QColor bgColorEnd);
|
void setBgColor ( QColor bgColorStart, QColor bgColorEnd );
|
||||||
/*设置线条颜色*/
|
/*设置线条颜色*/
|
||||||
void setLineColor(QColor lineColor);
|
void setLineColor ( QColor lineColor );
|
||||||
/*设置滑块颜色*/
|
/*设置滑块颜色*/
|
||||||
void setSliderColor(QColor sliderColorTop, QColor sliderColorBottom);
|
void setSliderColor ( QColor sliderColorTop, QColor sliderColorBottom );
|
||||||
/*设置提示信息背景*/
|
/*设置提示信息背景*/
|
||||||
void setTipBgColor(QColor tipBgColor, QColor tipTextColor);
|
void setTipBgColor ( QColor tipBgColor, QColor tipTextColor );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void valueChanged(double value);
|
void valueChanged ( double value );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTRULEREFFECTSLIDER_H
|
#endif // QQTRULERSLIDER_H
|
@ -1,18 +1,18 @@
|
|||||||
#include "qqtshadoweffectwidget.h"
|
#include "qqtshadowwidget.h"
|
||||||
|
|
||||||
QQtShadowEffectWidget::QQtShadowEffectWidget(QWidget* parent) : QWidget(parent)
|
QQtShadowWidget::QQtShadowWidget(QWidget* parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
//this->setWindowFlags(Qt::FramelessWindowHint);
|
//this->setWindowFlags(Qt::FramelessWindowHint);
|
||||||
//this->setAttribute(Qt::WA_TranslucentBackground);
|
//this->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
drawShadowPlanA();
|
drawShadowPlanA();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtShadowEffectWidget::paintEvent(QPaintEvent* e)
|
void QQtShadowWidget::paintEvent(QPaintEvent* e)
|
||||||
{
|
{
|
||||||
QWidget::paintEvent(e);
|
QWidget::paintEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtShadowEffectWidget::drawShadowPlanA()
|
void QQtShadowWidget::drawShadowPlanA()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* blurRadius 阴影清晰度,越小越清晰
|
* blurRadius 阴影清晰度,越小越清晰
|
||||||
@ -26,7 +26,7 @@ void QQtShadowEffectWidget::drawShadowPlanA()
|
|||||||
this->setGraphicsEffect(shadow);
|
this->setGraphicsEffect(shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtShadowEffectWidget::drawShadowPlanB()
|
void QQtShadowWidget::drawShadowPlanB()
|
||||||
{
|
{
|
||||||
//画阴影边框方案[B]
|
//画阴影边框方案[B]
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTSHOWDOWEFFECTWIDGET_H
|
#ifndef QQTSHADOWWIDGET_H
|
||||||
#define QQTSHOWDOWEFFECTWIDGET_H
|
#define QQTSHADOWWIDGET_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T.D.R (QQ:2657635903) 2017年10月22日17:47:18
|
* T.D.R (QQ:2657635903) 2017年10月22日17:47:18
|
||||||
@ -20,24 +20,24 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtShadowEffectWidget class 阴影widget基类
|
* @brief The QQtShadowWidget class 带阴影的widget基类
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtShadowEffectWidget : public QWidget
|
class QQTSHARED_EXPORT QQtShadowWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief QQtShadowEffectWidget 构造函数
|
* @brief QQtShadowWidget 构造函数
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
explicit QQtShadowEffectWidget(QWidget* parent = 0);
|
explicit QQtShadowWidget ( QWidget* parent = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief paintEvent 绘制事件处理函数
|
* @brief paintEvent 绘制事件处理函数
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
void paintEvent(QPaintEvent* e);
|
void paintEvent ( QPaintEvent* e );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -53,4 +53,4 @@ private:
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTSHOWDOWEFFECTWIDGET_H
|
#endif // QQTSHADOWWIDGET_H
|
@ -1,14 +0,0 @@
|
|||||||
#include "qqtslideeffecttabwidget.h"
|
|
||||||
|
|
||||||
QQtSlideEffectTabWidget::QQtSlideEffectTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
|
||||||
{
|
|
||||||
m_bar = new QQtSlideEffectTabBar(this);
|
|
||||||
setTabBar(m_bar);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QQtSlideEffectTabWidget::setObjectName(const QString& name)
|
|
||||||
{
|
|
||||||
m_bar->setObjectName(QString("%1_bar").arg(name));
|
|
||||||
return QQtTabWidget::setObjectName(name);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#ifndef QQTSLIDEEFFECTTABWIDGET_H
|
|
||||||
#define QQTSLIDEEFFECTTABWIDGET_H
|
|
||||||
|
|
||||||
#include <qqttabwidget.h>
|
|
||||||
#include <qqtslideeffecttabbar.h>
|
|
||||||
|
|
||||||
class QQtSlideEffectTabWidget : public QQtTabWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QQtSlideEffectTabWidget(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private:
|
|
||||||
QQtSlideEffectTabBar* m_bar;
|
|
||||||
|
|
||||||
// QQtTabWidget interface
|
|
||||||
public:
|
|
||||||
virtual void setObjectName(const QString& name) override;
|
|
||||||
virtual QQtTabBar* localTabBar() const override { return m_bar; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QQTSLIDEEFFECTTABWIDGET_H
|
|
@ -1,9 +1,9 @@
|
|||||||
#include "qqtslideeffecttabbar.h"
|
#include "qqtslidetabbar.h"
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <qqtcore.h>
|
#include <qqtcore.h>
|
||||||
|
|
||||||
QQtSlideEffectTabBar::QQtSlideEffectTabBar ( QWidget* parent ) : QQtTabBar ( parent )
|
QQtSlideTabBar::QQtSlideTabBar ( QWidget* parent ) : QQtTabBar ( parent )
|
||||||
{
|
{
|
||||||
slideSpeed = 10;
|
slideSpeed = 10;
|
||||||
cornerRadius = 6;
|
cornerRadius = 6;
|
||||||
@ -13,7 +13,7 @@ QQtSlideEffectTabBar::QQtSlideEffectTabBar ( QWidget* parent ) : QQtTabBar ( par
|
|||||||
connect ( timer, SIGNAL ( timeout() ), this, SLOT ( updateTabBarRect() ) );
|
connect ( timer, SIGNAL ( timeout() ), this, SLOT ( updateTabBarRect() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::setSlideSpeed ( int slideSpeed )
|
void QQtSlideTabBar::setSlideSpeed ( int slideSpeed )
|
||||||
{
|
{
|
||||||
if ( this->slideSpeed != slideSpeed )
|
if ( this->slideSpeed != slideSpeed )
|
||||||
{
|
{
|
||||||
@ -21,7 +21,7 @@ void QQtSlideEffectTabBar::setSlideSpeed ( int slideSpeed )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::setCornerRadius ( int cornerRadius )
|
void QQtSlideTabBar::setCornerRadius ( int cornerRadius )
|
||||||
{
|
{
|
||||||
if ( this->cornerRadius != cornerRadius )
|
if ( this->cornerRadius != cornerRadius )
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ void QQtSlideEffectTabBar::setCornerRadius ( int cornerRadius )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::paintEvent ( QPaintEvent* event )
|
void QQtSlideTabBar::paintEvent ( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
int width = this->width();
|
int width = this->width();
|
||||||
int height = this->height();
|
int height = this->height();
|
||||||
@ -54,7 +54,7 @@ void QQtSlideEffectTabBar::paintEvent ( QPaintEvent* event )
|
|||||||
drawTabBarText ( &painter );
|
drawTabBarText ( &painter );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::drawBackground ( QPainter* painter )
|
void QQtSlideTabBar::drawBackground ( QPainter* painter )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
QPalette pale = palette();
|
QPalette pale = palette();
|
||||||
@ -63,7 +63,7 @@ void QQtSlideEffectTabBar::drawBackground ( QPainter* painter )
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::drawTabBar ( QPainter* painter )
|
void QQtSlideTabBar::drawTabBar ( QPainter* painter )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
QPalette pale = palette();
|
QPalette pale = palette();
|
||||||
@ -72,12 +72,12 @@ void QQtSlideEffectTabBar::drawTabBar ( QPainter* painter )
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::drawTabBarIcon ( QPainter* painter )
|
void QQtSlideTabBar::drawTabBarIcon ( QPainter* painter )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::drawTabBarText ( QPainter* painter )
|
void QQtSlideTabBar::drawTabBarText ( QPainter* painter )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ void QQtSlideEffectTabBar::drawTabBarText ( QPainter* painter )
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::updateTabBarRect()
|
void QQtSlideTabBar::updateTabBarRect()
|
||||||
{
|
{
|
||||||
if ( m_targetRect.top() == m_barRect.top() )
|
if ( m_targetRect.top() == m_barRect.top() )
|
||||||
{
|
{
|
||||||
@ -166,7 +166,7 @@ void QQtSlideEffectTabBar::updateTabBarRect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::mousePressEvent ( QMouseEvent* event )
|
void QQtSlideTabBar::mousePressEvent ( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
m_barRect = tabRect ( currentIndex() );
|
m_barRect = tabRect ( currentIndex() );
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ void QQtSlideEffectTabBar::mousePressEvent ( QMouseEvent* event )
|
|||||||
return QTabBar::mousePressEvent ( event );
|
return QTabBar::mousePressEvent ( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtSlideEffectTabBar::mouseReleaseEvent ( QMouseEvent* event )
|
void QQtSlideTabBar::mouseReleaseEvent ( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
return QTabBar::mouseReleaseEvent ( event );
|
return QTabBar::mouseReleaseEvent ( event );
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTSLIDEEFFECTTABBAR_H
|
#ifndef QQTSLIDETABBAR_H
|
||||||
#define QQTSLIDEEFFECTTABBAR_H
|
#define QQTSLIDETABBAR_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DrAbel set (QQ:2657635903) 2017年11月05日18:00:16
|
* DrAbel set (QQ:2657635903) 2017年11月05日18:00:16
|
||||||
@ -12,35 +12,35 @@
|
|||||||
#include <qqtcore.h>
|
#include <qqtcore.h>
|
||||||
#include <qqttabbar.h>
|
#include <qqttabbar.h>
|
||||||
|
|
||||||
class QQtSlideEffectTabBar : public QQtTabBar
|
class QQtSlideTabBar : public QQtTabBar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QQtSlideEffectTabBar(QWidget* parent = nullptr);
|
explicit QQtSlideTabBar ( QWidget* parent = nullptr );
|
||||||
virtual ~QQtSlideEffectTabBar() {}
|
virtual ~QQtSlideTabBar() {}
|
||||||
/**
|
/**
|
||||||
* @brief setSlideSpeed
|
* @brief setSlideSpeed
|
||||||
* 滑动速度 1-100 default:10
|
* 滑动速度 1-100 default:10
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getSlideSpeed() const { return slideSpeed; }
|
int getSlideSpeed() const { return slideSpeed; }
|
||||||
void setSlideSpeed(int slideSpeed);
|
void setSlideSpeed ( int slideSpeed );
|
||||||
/**
|
/**
|
||||||
* @brief getCornerRadius
|
* @brief getCornerRadius
|
||||||
* Tab的圆角 1-70? default:6
|
* Tab的圆角 1-70? default:6
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getCornerRadius() const { return cornerRadius; }
|
int getCornerRadius() const { return cornerRadius; }
|
||||||
void setCornerRadius(int cornerRadius);
|
void setCornerRadius ( int cornerRadius );
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void drawBackground(QPainter* painter);
|
virtual void drawBackground ( QPainter* painter );
|
||||||
virtual void drawTabBar(QPainter* painter);
|
virtual void drawTabBar ( QPainter* painter );
|
||||||
virtual void drawTabBarIcon(QPainter* painter);
|
virtual void drawTabBarIcon ( QPainter* painter );
|
||||||
virtual void drawTabBarText(QPainter* painter);
|
virtual void drawTabBarText ( QPainter* painter );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateTabBarRect();
|
void updateTabBarRect();
|
||||||
@ -54,15 +54,15 @@ private:
|
|||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) override;
|
virtual void paintEvent ( QPaintEvent* event ) override;
|
||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
virtual void mousePressEvent ( QMouseEvent* event ) override;
|
||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
virtual void mouseReleaseEvent ( QMouseEvent* event ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTSLIDEEFFECTTABBAR_H
|
#endif // QQTSLIDETABBAR_H
|
14
src/exquisite/qqtslidetabwidget.cpp
Normal file
14
src/exquisite/qqtslidetabwidget.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "qqtslidetabwidget.h"
|
||||||
|
|
||||||
|
QQtSlideTabWidget::QQtSlideTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
||||||
|
{
|
||||||
|
m_bar = new QQtSlideTabBar(this);
|
||||||
|
setTabBar(m_bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QQtSlideTabWidget::setObjectName(const QString& name)
|
||||||
|
{
|
||||||
|
m_bar->setObjectName(QString("%1_bar").arg(name));
|
||||||
|
return QQtTabWidget::setObjectName(name);
|
||||||
|
}
|
26
src/exquisite/qqtslidetabwidget.h
Normal file
26
src/exquisite/qqtslidetabwidget.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef QQTSLIDETABWIDGET_H
|
||||||
|
#define QQTSLIDETABWIDGET_H
|
||||||
|
|
||||||
|
#include <qqttabwidget.h>
|
||||||
|
#include <qqtslidetabbar.h>
|
||||||
|
|
||||||
|
class QQtSlideTabWidget : public QQtTabWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtSlideTabWidget ( QWidget* parent = nullptr );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QQtSlideTabBar* m_bar;
|
||||||
|
|
||||||
|
// QQtTabWidget interface
|
||||||
|
public:
|
||||||
|
virtual void setObjectName ( const QString& name ) override;
|
||||||
|
virtual QQtTabBar* localTabBar() const override { return m_bar; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTSLIDETABWIDGET_H
|
@ -31,9 +31,9 @@ QQtApplication::QQtApplication ( int& argc, char** argv ) :
|
|||||||
#endif
|
#endif
|
||||||
QTextCodec::setCodecForLocale ( QTextCodec::codecForName ( "UTF-8" ) );
|
QTextCodec::setCodecForLocale ( QTextCodec::codecForName ( "UTF-8" ) );
|
||||||
|
|
||||||
/*嵌入式,应用名称必须指定*/
|
/*嵌入式,应用名称必须指定 配置文件路径$CONF_PATH/organizationName/applicationName.conf[.ini]*/
|
||||||
QCoreApplication::setOrganizationName ( "QQt" );
|
QCoreApplication::setOrganizationName ( "QQt" );
|
||||||
/*专为Mac OS X 准备的,macOS下配置文件: CONF_PATH/organizationDomain/ApplicationName.ini ... */
|
/*专为Mac OS X 准备的,macOS下配置文件: $CONF_PATH/organizationDomain/ApplicationName.ini ... */
|
||||||
QCoreApplication::setOrganizationDomain ( "www.qqt.com" ); //
|
QCoreApplication::setOrganizationDomain ( "www.qqt.com" ); //
|
||||||
QCoreApplication::setApplicationName ( "QQt" );
|
QCoreApplication::setApplicationName ( "QQt" );
|
||||||
|
|
||||||
@ -49,6 +49,9 @@ QQtApplication::QQtApplication ( int& argc, char** argv ) :
|
|||||||
QDir::setCurrent ( qApp->applicationDirPath() );
|
QDir::setCurrent ( qApp->applicationDirPath() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*在linux系统,不自动在当前目录寻找lib,需要命令行设置LD_LIBRARY_PATH,这里添加一下自动查找,不冲突。*/
|
||||||
|
addLibraryPath ( qApp->applicationDirPath() );//[qApp->]
|
||||||
|
|
||||||
pline() << "app root:" << qApp->applicationDirPath();
|
pline() << "app root:" << qApp->applicationDirPath();
|
||||||
pline() << "app work root:" << QDir::currentPath();
|
pline() << "app work root:" << QDir::currentPath();
|
||||||
pline() << "Qt version:" << QT_VERSION_STR;
|
pline() << "Qt version:" << QT_VERSION_STR;
|
||||||
@ -126,7 +129,6 @@ void QQtApplication::setQSSStyle ( QString qssfile )
|
|||||||
//setPalette(QPalette(QColor("#F0F0F0")));
|
//setPalette(QPalette(QColor("#F0F0F0")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtApplication::setUPanAutorun ( bool run )
|
void QQtApplication::setUPanAutorun ( bool run )
|
||||||
{
|
{
|
||||||
bUPanAutoRun = run;
|
bUPanAutoRun = run;
|
||||||
|
@ -21,6 +21,7 @@ public:
|
|||||||
//palette
|
//palette
|
||||||
void setTextFont ( QString fontfile = "/usr/lib/fonts/heiti.ttf",
|
void setTextFont ( QString fontfile = "/usr/lib/fonts/heiti.ttf",
|
||||||
int fontsize = 11 );
|
int fontsize = 11 );
|
||||||
|
//这是设置全部控件的,基本的QSS,通用的QSS,全在这个里,特殊不变的也允许放在这里。
|
||||||
void setQSSStyle ( QString qssfile = "./skin/default.qss" );
|
void setQSSStyle ( QString qssfile = "./skin/default.qss" );
|
||||||
void setUPanAutorun ( bool run = false );
|
void setUPanAutorun ( bool run = false );
|
||||||
void setWriteLogSystem ( bool open = true );
|
void setWriteLogSystem ( bool open = true );
|
||||||
@ -29,10 +30,15 @@ public:
|
|||||||
virtual int initInstance() { return 0; }
|
virtual int initInstance() { return 0; }
|
||||||
virtual int unInitInstance() { return 0; }
|
virtual int unInitInstance() { return 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户从这里接收语言更改信号,更改所有窗口的语言。
|
||||||
|
*/
|
||||||
signals:
|
signals:
|
||||||
void languageChanged();
|
void languageChanged();
|
||||||
|
|
||||||
|
//这个是给PluginWatcher用的,和用户无关。允许重写
|
||||||
public slots:
|
public slots:
|
||||||
void slotUPanAutoRun ( int status );
|
virtual void slotUPanAutoRun ( int status );
|
||||||
private:
|
private:
|
||||||
bool bUPanAutoRun;
|
bool bUPanAutoRun;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef QQTFRAMEDEFINE_H
|
#ifndef QQTFRAMEDEFINE_H
|
||||||
#define QQTFRAMEDEFINE_H
|
#define QQTFRAMEDEFINE_H
|
||||||
|
|
||||||
|
|
||||||
@ -114,20 +114,24 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define CONFIG_ROOT "."
|
||||||
#define CONFIG_PATH "./conf"
|
#define CONFIG_PATH "./conf"
|
||||||
#define LOG_PATH "./log"
|
#define LOG_PATH "./log"
|
||||||
#define AV_PATH "./res"
|
#define AV_PATH "./res"
|
||||||
#define SKIN_PATH "./skin"
|
#define SKIN_PATH "./skin"
|
||||||
|
|
||||||
#if defined (__ANDROIDX86__)
|
#if defined (__ANDROIDX86__)
|
||||||
|
#define qrc(file) QString("%1/%2").arg("assets:/").arg(file)
|
||||||
#define res(file) QString("%1/%2").arg("assets:/res").arg(file)
|
#define res(file) QString("%1/%2").arg("assets:/res").arg(file)
|
||||||
#define skin(file) QString("%1/%2").arg("assets:/skin").arg(file)
|
#define skin(file) QString("%1/%2").arg("assets:/skin").arg(file)
|
||||||
#elif defined (__ANDROID__)
|
#elif defined (__ANDROID__)
|
||||||
|
#define qrc(file) QString("%1/%2").arg("://").arg(file)
|
||||||
#define res(file) QString("%1/%2").arg("://res").arg(file)
|
#define res(file) QString("%1/%2").arg("://res").arg(file)
|
||||||
#define skin(file) QString("%1/%2").arg("://skin").arg(file)
|
#define skin(file) QString("%1/%2").arg("://skin").arg(file)
|
||||||
#else
|
#else
|
||||||
#define res(file) QDir().relativeFilePath(QString("./res/%1").arg(file))
|
#define qrc(file) QDir(qApp->applicationDirPath()).relativeFilePath(QString("%1/%2").arg(CONFIG_ROOT).arg(file))
|
||||||
#define skin(file) QDir().relativeFilePath(QString("./skin/%1").arg(file))
|
#define res(file) QDir(qApp->applicationDirPath()).relativeFilePath(QString("%1/%2").arg(AV_PATH).arg(file))
|
||||||
|
#define skin(file) QDir(qApp->applicationDirPath()).relativeFilePath(QString("%1/%2").arg(SKIN_PATH).arg(file))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,50 +120,50 @@ void QQtInput::InitForm()
|
|||||||
currentBrowser = 0;
|
currentBrowser = 0;
|
||||||
currentEditType = "";
|
currentEditType = "";
|
||||||
|
|
||||||
ui->btnDel->iconTable() [BTN_NORMAL] = "./skin/default/key_del.png";
|
ui->btnDel->iconTable() [BTN_NORMAL] = "./skin/input/key_del.png";
|
||||||
ui->btnDel->iconTable() [BTN_PRESS] = "./skin/default/key_del_press.png";
|
ui->btnDel->iconTable() [BTN_PRESS] = "./skin/input/key_del_press.png";
|
||||||
ui->btnDel->iconTable() [BTN_UNCHECK] = "./skin/default/key_del.png";
|
ui->btnDel->iconTable() [BTN_UNCHECK] = "./skin/input/key_del.png";
|
||||||
ui->btnDel->iconTable() [BTN_CHECK] = "./skin/default/key_del_press.png";
|
ui->btnDel->iconTable() [BTN_CHECK] = "./skin/input/key_del_press.png";
|
||||||
ui->btnDel->iconTable() [BTN_HOVER] = "./skin/default/key_del.png";
|
ui->btnDel->iconTable() [BTN_HOVER] = "./skin/input/key_del.png";
|
||||||
ui->btnDel->iconTable() [BTN_DISABLE] = "./skin/default/key_del.png";
|
ui->btnDel->iconTable() [BTN_DISABLE] = "./skin/input/key_del.png";
|
||||||
|
|
||||||
ui->btnDelete->iconTable() [BTN_NORMAL] = "./skin/default/key_del.png";
|
ui->btnDelete->iconTable() [BTN_NORMAL] = "./skin/input/key_del.png";
|
||||||
ui->btnDelete->iconTable() [BTN_PRESS] = "./skin/default/key_del_press.png";
|
ui->btnDelete->iconTable() [BTN_PRESS] = "./skin/input/key_del_press.png";
|
||||||
ui->btnDelete->iconTable() [BTN_UNCHECK] = "./skin/default/key_del.png";
|
ui->btnDelete->iconTable() [BTN_UNCHECK] = "./skin/input/key_del.png";
|
||||||
ui->btnDelete->iconTable() [BTN_CHECK] = "./skin/default/key_del_press.png";
|
ui->btnDelete->iconTable() [BTN_CHECK] = "./skin/input/key_del_press.png";
|
||||||
ui->btnDelete->iconTable() [BTN_HOVER] = "./skin/default/key_del.png";
|
ui->btnDelete->iconTable() [BTN_HOVER] = "./skin/input/key_del.png";
|
||||||
ui->btnDelete->iconTable() [BTN_DISABLE] = "./skin/default/key_del.png";
|
ui->btnDelete->iconTable() [BTN_DISABLE] = "./skin/input/key_del.png";
|
||||||
|
|
||||||
ui->btnClose->iconTable() [BTN_NORMAL] = "./skin/default/key_close.png";
|
ui->btnClose->iconTable() [BTN_NORMAL] = "./skin/input/key_close.png";
|
||||||
ui->btnClose->iconTable() [BTN_PRESS] = "./skin/default/key_close_press.png";
|
ui->btnClose->iconTable() [BTN_PRESS] = "./skin/input/key_close_press.png";
|
||||||
ui->btnClose->iconTable() [BTN_UNCHECK] = "./skin/default/key_close.png";
|
ui->btnClose->iconTable() [BTN_UNCHECK] = "./skin/input/key_close.png";
|
||||||
ui->btnClose->iconTable() [BTN_CHECK] = "./skin/default/key_close_press.png";
|
ui->btnClose->iconTable() [BTN_CHECK] = "./skin/input/key_close_press.png";
|
||||||
ui->btnClose->iconTable() [BTN_HOVER] = "./skin/default/key_close.png";
|
ui->btnClose->iconTable() [BTN_HOVER] = "./skin/input/key_close.png";
|
||||||
ui->btnClose->iconTable() [BTN_DISABLE] = "./skin/default/key_close.png";
|
ui->btnClose->iconTable() [BTN_DISABLE] = "./skin/input/key_close.png";
|
||||||
|
|
||||||
ui->btnSpace->iconTable() [BTN_NORMAL] = "./skin/default/key_blank.png";
|
ui->btnSpace->iconTable() [BTN_NORMAL] = "./skin/input/key_blank.png";
|
||||||
ui->btnSpace->iconTable() [BTN_PRESS] = "./skin/default/key_blank_press.png";
|
ui->btnSpace->iconTable() [BTN_PRESS] = "./skin/input/key_blank_press.png";
|
||||||
ui->btnSpace->iconTable() [BTN_UNCHECK] = "./skin/default/key_blank.png";
|
ui->btnSpace->iconTable() [BTN_UNCHECK] = "./skin/input/key_blank.png";
|
||||||
ui->btnSpace->iconTable() [BTN_CHECK] = "./skin/default/key_blank_press.png";
|
ui->btnSpace->iconTable() [BTN_CHECK] = "./skin/input/key_blank_press.png";
|
||||||
ui->btnSpace->iconTable() [BTN_HOVER] = "./skin/default/key_blank.png";
|
ui->btnSpace->iconTable() [BTN_HOVER] = "./skin/input/key_blank.png";
|
||||||
ui->btnSpace->iconTable() [BTN_DISABLE] = "./skin/default/key_blank.png";
|
ui->btnSpace->iconTable() [BTN_DISABLE] = "./skin/input/key_blank.png";
|
||||||
|
|
||||||
ui->btnReturn->iconTable() [BTN_NORMAL] = "./skin/default/key_return.png";
|
ui->btnReturn->iconTable() [BTN_NORMAL] = "./skin/input/key_return.png";
|
||||||
ui->btnReturn->iconTable() [BTN_PRESS] = "./skin/default/key_return_press.png";
|
ui->btnReturn->iconTable() [BTN_PRESS] = "./skin/input/key_return_press.png";
|
||||||
ui->btnReturn->iconTable() [BTN_UNCHECK] = "./skin/default/key_return.png";
|
ui->btnReturn->iconTable() [BTN_UNCHECK] = "./skin/input/key_return.png";
|
||||||
ui->btnReturn->iconTable() [BTN_CHECK] = "./skin/default/key_return_press.png";
|
ui->btnReturn->iconTable() [BTN_CHECK] = "./skin/input/key_return_press.png";
|
||||||
ui->btnReturn->iconTable() [BTN_HOVER] = "./skin/default/key_return.png";
|
ui->btnReturn->iconTable() [BTN_HOVER] = "./skin/input/key_return.png";
|
||||||
ui->btnReturn->iconTable() [BTN_DISABLE] = "./skin/default/key_return.png";
|
ui->btnReturn->iconTable() [BTN_DISABLE] = "./skin/input/key_return.png";
|
||||||
|
|
||||||
ui->radioCN->setPixmap ( "./skin/default/key.png", "./skin/default/key_press.png" );
|
ui->radioCN->setPixmap ( "./skin/input/key.png", "./skin/input/key_press.png" );
|
||||||
ui->radioCN->setFixedSize ( btnWidth, btnHeight );
|
ui->radioCN->setFixedSize ( btnWidth, btnHeight );
|
||||||
ui->radioCN->setPixmap ( "./skin/default/key.png", "./skin/default/key_press.png" );
|
ui->radioCN->setPixmap ( "./skin/input/key.png", "./skin/input/key_press.png" );
|
||||||
ui->radioEN->setFixedSize ( btnWidth, btnHeight );
|
ui->radioEN->setFixedSize ( btnWidth, btnHeight );
|
||||||
ui->radioEN->setPixmap ( "./skin/default/key.png", "./skin/default/key_press.png" );
|
ui->radioEN->setPixmap ( "./skin/input/key.png", "./skin/input/key_press.png" );
|
||||||
ui->radioEN->setFixedSize ( btnWidth, btnHeight );
|
ui->radioEN->setFixedSize ( btnWidth, btnHeight );
|
||||||
ui->radioNum->setPixmap ( "./skin/default/key.png", "./skin/default/key_press.png" );
|
ui->radioNum->setPixmap ( "./skin/input/key.png", "./skin/input/key_press.png" );
|
||||||
ui->radioNum->setFixedSize ( btnWidth, btnHeight );
|
ui->radioNum->setFixedSize ( btnWidth, btnHeight );
|
||||||
ui->checkShift->setPixmap ( "./skin/default/key_shift.png", "./skin/default/key_shift_press.png" );
|
ui->checkShift->setPixmap ( "./skin/input/key_shift.png", "./skin/input/key_shift_press.png" );
|
||||||
ui->checkShift->setFixedSize ( btnWidth, btnHeight );
|
ui->checkShift->setFixedSize ( btnWidth, btnHeight );
|
||||||
|
|
||||||
connect ( ui->radioNum, SIGNAL ( clicked() ), this, SLOT ( btn_clicked() ) );
|
connect ( ui->radioNum, SIGNAL ( clicked() ), this, SLOT ( btn_clicked() ) );
|
||||||
@ -370,7 +370,7 @@ void QQtInput::btn_clicked()
|
|||||||
if ( currentType == "min" || currentType == "max" )
|
if ( currentType == "min" || currentType == "max" )
|
||||||
{
|
{
|
||||||
currentType = "chinese";
|
currentType = "chinese";
|
||||||
ui->checkShift->setPixmap ( "./skin/default/key_hidden.png", "./skin/default/key_hidden.png" );
|
ui->checkShift->setPixmap ( "./skin/input/key_hidden.png", "./skin/input/key_hidden.png" );
|
||||||
|
|
||||||
if ( ui->checkShift->isChecked() )
|
if ( ui->checkShift->isChecked() )
|
||||||
ui->checkShift->setChecked ( false );
|
ui->checkShift->setChecked ( false );
|
||||||
@ -395,7 +395,7 @@ void QQtInput::btn_clicked()
|
|||||||
else if ( currentType == "chinese" )
|
else if ( currentType == "chinese" )
|
||||||
{
|
{
|
||||||
currentType = "min";
|
currentType = "min";
|
||||||
ui->checkShift->setPixmap ( "./skin/default/key_shift.png", "./skin/default/key_shift_press.png" );
|
ui->checkShift->setPixmap ( "./skin/input/key_shift.png", "./skin/input/key_shift_press.png" );
|
||||||
|
|
||||||
if ( ui->checkShift->isChecked() )
|
if ( ui->checkShift->isChecked() )
|
||||||
ui->checkShift->setChecked ( false );
|
ui->checkShift->setChecked ( false );
|
||||||
@ -797,7 +797,6 @@ void QQtInput::focusChanged ( QWidget* oldWidget, QWidget* nowWidget )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
|
|
||||||
if ( nowWidget->inherits ( "QLineEdit" ) )
|
if ( nowWidget->inherits ( "QLineEdit" ) )
|
||||||
{
|
{
|
||||||
QLineEdit* lineedit = ( QLineEdit* ) nowWidget;
|
QLineEdit* lineedit = ( QLineEdit* ) nowWidget;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "qqtmptablewidget.h"
|
#include "qqtmultipagetablewidget.h"
|
||||||
#include "ui_qqtmptablewidget.h"
|
#include "ui_qqtmultipagetablewidget.h"
|
||||||
#include "qqtcore.h"
|
#include "qqtcore.h"
|
||||||
#include "qqtsql.h"
|
#include "qqtsql.h"
|
||||||
#include "qqt-qt.h"
|
#include "qqt-qt.h"
|
||||||
|
|
||||||
QQtMPTableWidget::QQtMPTableWidget ( QWidget* parent ) :
|
QQtMultiPageTableWidget::QQtMultiPageTableWidget ( QWidget* parent ) :
|
||||||
QWidget ( parent ),
|
QWidget ( parent ),
|
||||||
ui ( new Ui::QQtMPTableWidget )
|
ui ( new Ui::QQtMultiPageTableWidget )
|
||||||
{
|
{
|
||||||
ui->setupUi ( this );
|
ui->setupUi ( this );
|
||||||
|
|
||||||
@ -33,28 +33,28 @@ QQtMPTableWidget::QQtMPTableWidget ( QWidget* parent ) :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtMPTableWidget::~QQtMPTableWidget()
|
QQtMultiPageTableWidget::~QQtMultiPageTableWidget()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setDB ( QString db )
|
void QQtMultiPageTableWidget::setDB ( QString db )
|
||||||
{
|
{
|
||||||
m_name = db;
|
m_name = db;
|
||||||
setDatabaseName ( m_db, m_name );
|
setDatabaseName ( m_db, m_name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setTable ( QString table )
|
void QQtMultiPageTableWidget::setTable ( QString table )
|
||||||
{
|
{
|
||||||
m_table = table;
|
m_table = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setRelation ( int column, const QSqlRelation& relation )
|
void QQtMultiPageTableWidget::setRelation ( int column, const QSqlRelation& relation )
|
||||||
{
|
{
|
||||||
m_columnRelation.insert ( column, relation );
|
m_columnRelation.insert ( column, relation );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::query ( QString filter )
|
void QQtMultiPageTableWidget::query ( QString filter )
|
||||||
{
|
{
|
||||||
ptime(); //3ms
|
ptime(); //3ms
|
||||||
|
|
||||||
@ -160,17 +160,17 @@ void QQtMPTableWidget::query ( QString filter )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtMPTableWidget::pageNum()
|
int QQtMultiPageTableWidget::pageNum()
|
||||||
{
|
{
|
||||||
return m_pageNum;
|
return m_pageNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QQtMPTableWidget::currentPage()
|
int QQtMultiPageTableWidget::currentPage()
|
||||||
{
|
{
|
||||||
return ui->stWidgetPage->currentIndex() + 1;
|
return ui->stWidgetPage->currentIndex() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setCurrentPage ( int index )
|
void QQtMultiPageTableWidget::setCurrentPage ( int index )
|
||||||
{
|
{
|
||||||
if ( index < 1 || index > m_pageNum )
|
if ( index < 1 || index > m_pageNum )
|
||||||
return;
|
return;
|
||||||
@ -179,37 +179,37 @@ void QQtMPTableWidget::setCurrentPage ( int index )
|
|||||||
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index ).arg ( m_pageNum ) );
|
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index ).arg ( m_pageNum ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setRecordNumPerPage ( int num )
|
void QQtMultiPageTableWidget::setRecordNumPerPage ( int num )
|
||||||
{
|
{
|
||||||
m_numPerPage = num;
|
m_numPerPage = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setColumnHidden ( int key, bool value )
|
void QQtMultiPageTableWidget::setColumnHidden ( int key, bool value )
|
||||||
{
|
{
|
||||||
m_columnHidden.insert ( key, value );
|
m_columnHidden.insert ( key, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setSelectionMode ( QAbstractItemView::SelectionMode mode )
|
void QQtMultiPageTableWidget::setSelectionMode ( QAbstractItemView::SelectionMode mode )
|
||||||
{
|
{
|
||||||
selectionMode = mode;
|
selectionMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setResizeMode ( QHeaderView::ResizeMode mode )
|
void QQtMultiPageTableWidget::setResizeMode ( QHeaderView::ResizeMode mode )
|
||||||
{
|
{
|
||||||
resizeMode = mode;
|
resizeMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setResizeMode ( int column, QHeaderView::ResizeMode mode )
|
void QQtMultiPageTableWidget::setResizeMode ( int column, QHeaderView::ResizeMode mode )
|
||||||
{
|
{
|
||||||
m_resizeMode.insert ( column, mode );
|
m_resizeMode.insert ( column, mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setAlternatingRowColors ( bool alt )
|
void QQtMultiPageTableWidget::setAlternatingRowColors ( bool alt )
|
||||||
{
|
{
|
||||||
altColor = alt;
|
altColor = alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setHeaderData ( Qt::Orientation, QStringList dataList )
|
void QQtMultiPageTableWidget::setHeaderData ( Qt::Orientation, QStringList dataList )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < dataList.size(); i++ )
|
for ( int i = 0; i < dataList.size(); i++ )
|
||||||
{
|
{
|
||||||
@ -217,17 +217,17 @@ void QQtMPTableWidget::setHeaderData ( Qt::Orientation, QStringList dataList )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setHeaderData ( int i, Qt::Orientation, QString data )
|
void QQtMultiPageTableWidget::setHeaderData ( int i, Qt::Orientation, QString data )
|
||||||
{
|
{
|
||||||
m_headerData.insert ( i, data );
|
m_headerData.insert ( i, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::setColumnWidth ( int column, int width )
|
void QQtMultiPageTableWidget::setColumnWidth ( int column, int width )
|
||||||
{
|
{
|
||||||
m_columnWidth.insert ( column, width );
|
m_columnWidth.insert ( column, width );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::on_btnLeft_clicked()
|
void QQtMultiPageTableWidget::on_btnLeft_clicked()
|
||||||
{
|
{
|
||||||
int index = ui->stWidgetPage->currentIndex();
|
int index = ui->stWidgetPage->currentIndex();
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ void QQtMPTableWidget::on_btnLeft_clicked()
|
|||||||
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index + 1 ).arg ( m_pageNum ) );
|
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index + 1 ).arg ( m_pageNum ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::on_btnRight_clicked()
|
void QQtMultiPageTableWidget::on_btnRight_clicked()
|
||||||
{
|
{
|
||||||
int index = ui->stWidgetPage->currentIndex();
|
int index = ui->stWidgetPage->currentIndex();
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ void QQtMPTableWidget::on_btnRight_clicked()
|
|||||||
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index + 1 ).arg ( m_pageNum ) );
|
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index + 1 ).arg ( m_pageNum ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::on_btnJump_clicked()
|
void QQtMultiPageTableWidget::on_btnJump_clicked()
|
||||||
{
|
{
|
||||||
int num = ui->leNum->text().toInt();
|
int num = ui->leNum->text().toInt();
|
||||||
|
|
||||||
@ -260,20 +260,20 @@ void QQtMPTableWidget::on_btnJump_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::on_btnLeftHead_clicked()
|
void QQtMultiPageTableWidget::on_btnLeftHead_clicked()
|
||||||
{
|
{
|
||||||
ui->stWidgetPage->setCurrentIndex ( 0 );
|
ui->stWidgetPage->setCurrentIndex ( 0 );
|
||||||
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( 1 ).arg ( m_pageNum ) );
|
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( 1 ).arg ( m_pageNum ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::on_btnRightHead_clicked()
|
void QQtMultiPageTableWidget::on_btnRightHead_clicked()
|
||||||
{
|
{
|
||||||
int index = m_pageNum - 1;
|
int index = m_pageNum - 1;
|
||||||
ui->stWidgetPage->setCurrentIndex ( index );
|
ui->stWidgetPage->setCurrentIndex ( index );
|
||||||
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index + 1 ).arg ( m_pageNum ) );
|
ui->lbPos->setText ( QString ( "%1/%2" ).arg ( index + 1 ).arg ( m_pageNum ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQtMPTableWidget::selectedRows ( int column, QVector<QStringList>& strl )
|
void QQtMultiPageTableWidget::selectedRows ( int column, QVector<QStringList>& strl )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < m_pageNum; i++ )
|
for ( int i = 0; i < m_pageNum; i++ )
|
||||||
{
|
{
|
||||||
@ -292,7 +292,7 @@ void QQtMPTableWidget::selectedRows ( int column, QVector<QStringList>& strl )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQtTableWidget* QQtMPTableWidget::selectedRows ( int column )
|
QQtTableWidget* QQtMultiPageTableWidget::selectedRows ( int column )
|
||||||
{
|
{
|
||||||
QString sectionName;
|
QString sectionName;
|
||||||
QSqlQuery query ( m_db );
|
QSqlQuery query ( m_db );
|
||||||
@ -346,7 +346,7 @@ QQtTableWidget* QQtMPTableWidget::selectedRows ( int column )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QQtMPTableWidget::removeSelectedRows ( int column )
|
void QQtMultiPageTableWidget::removeSelectedRows ( int column )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < m_pageNum; i++ )
|
for ( int i = 0; i < m_pageNum; i++ )
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef QQTMPTABLEWIDGET_H
|
#ifndef QQTMULTIPAGETABLEWIDGET_H
|
||||||
#define QQTMPTABLEWIDGET_H
|
#define QQTMULTIPAGETABLEWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QSqlRelationalTableModel>
|
#include <QSqlRelationalTableModel>
|
||||||
@ -9,11 +9,11 @@
|
|||||||
#include "qqt-local.h"
|
#include "qqt-local.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class QQtMPTableWidget;
|
class QQtMultiPageTableWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QQtMPTableWidget class
|
* @brief The QQtMultiPageTableWidget class
|
||||||
* 关于视图规格的改变改变到上层
|
* 关于视图规格的改变改变到上层
|
||||||
* 这里的控件使用默认视图
|
* 这里的控件使用默认视图
|
||||||
* 这里的控件只是Table-DB关系,没有Tree/List模型
|
* 这里的控件只是Table-DB关系,没有Tree/List模型
|
||||||
@ -22,13 +22,13 @@ class QQtMPTableWidget;
|
|||||||
* 后来,变动时,只有导致页数变动时才会慢一点点的感觉。
|
* 后来,变动时,只有导致页数变动时才会慢一点点的感觉。
|
||||||
* 平时查看,都是极速。
|
* 平时查看,都是极速。
|
||||||
*/
|
*/
|
||||||
class QQTSHARED_EXPORT QQtMPTableWidget : public QWidget
|
class QQTSHARED_EXPORT QQtMultiPageTableWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QQtMPTableWidget ( QWidget* parent = 0 );
|
explicit QQtMultiPageTableWidget ( QWidget* parent = 0 );
|
||||||
~QQtMPTableWidget();
|
~QQtMultiPageTableWidget();
|
||||||
|
|
||||||
void setDB ( QString db );
|
void setDB ( QString db );
|
||||||
void setTable ( QString table );
|
void setTable ( QString table );
|
||||||
@ -65,7 +65,7 @@ private slots:
|
|||||||
void on_btnRightHead_clicked();
|
void on_btnRightHead_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::QQtMPTableWidget* ui;
|
Ui::QQtMultiPageTableWidget* ui;
|
||||||
QSqlDatabase m_db;
|
QSqlDatabase m_db;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_table;
|
QString m_table;
|
||||||
@ -81,4 +81,4 @@ private:
|
|||||||
bool altColor;
|
bool altColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QQTMPTABLEWIDGET_H
|
#endif // QQTMULTIPAGETABLEWIDGET_H
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>QQtMPTableWidget</class>
|
<class>QQtMultiPageTableWidget</class>
|
||||||
<widget class="QWidget" name="QQtMPTableWidget">
|
<widget class="QWidget" name="QQtMultiPageTableWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
7
src/frame/qqtosdwidget.cpp
Normal file
7
src/frame/qqtosdwidget.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "qqtosdwidget.h"
|
||||||
|
|
||||||
|
QQtOSDWidget::QQtOSDWidget ( QWidget* parent ) : QQtWidget ( parent )
|
||||||
|
{
|
||||||
|
setAttribute ( Qt::WA_TranslucentBackground, true );
|
||||||
|
setAttribute ( Qt::WA_TransparentForMouseEvents, true );
|
||||||
|
}
|
21
src/frame/qqtosdwidget.h
Normal file
21
src/frame/qqtosdwidget.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef QQTOSDWIDGET_H
|
||||||
|
#define QQTOSDWIDGET_H
|
||||||
|
|
||||||
|
#include <qqtwidget.h>
|
||||||
|
|
||||||
|
#include <qqt-local.h>
|
||||||
|
#include <qqtcore.h>
|
||||||
|
|
||||||
|
class QQTSHARED_EXPORT QQtOSDWidget : public QQtWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtOSDWidget ( QWidget* parent = nullptr );
|
||||||
|
~QQtOSDWidget() {}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTOSDWIDGET_H
|
6
src/frame/qqtsysteminfo.cpp
Normal file
6
src/frame/qqtsysteminfo.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "qqtsysteminfo.h"
|
||||||
|
|
||||||
|
QQtSystemInfo::QQtSystemInfo ( QObject* parent ) : QObject ( parent )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
128
src/frame/qqtsysteminfo.h
Normal file
128
src/frame/qqtsysteminfo.h
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
#ifndef QQTSYSTEMINFO_H
|
||||||
|
#define QQTSYSTEMINFO_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <qqt-local.h>
|
||||||
|
#include <qqtcore.h>
|
||||||
|
|
||||||
|
#if defined (Q_OS_WIN32) || defined( Q_OS_WIN64)
|
||||||
|
#pragma once
|
||||||
|
#pragma comment(lib,"Kernel32.lib")
|
||||||
|
#pragma comment(lib,"Psapi.lib")
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <TlHelp32.h>
|
||||||
|
#include <direct.h>
|
||||||
|
#include <winternl.h>
|
||||||
|
#include <Psapi.h>
|
||||||
|
#endif
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct tDiskInfo
|
||||||
|
{
|
||||||
|
tDiskInfo() {}
|
||||||
|
quint64 mSize; //B
|
||||||
|
quint64 mAvalableSize; //B
|
||||||
|
} TDiskInfo;
|
||||||
|
|
||||||
|
typedef struct tDiskTable
|
||||||
|
{
|
||||||
|
tDiskTable() {}
|
||||||
|
quint64 mNum;
|
||||||
|
QList<TDiskInfo> mList;
|
||||||
|
} TDiskTable;
|
||||||
|
|
||||||
|
typedef struct tMemInfo
|
||||||
|
{
|
||||||
|
tMemInfo() {}
|
||||||
|
} TMemInfo;
|
||||||
|
|
||||||
|
typedef struct tMemTable
|
||||||
|
{
|
||||||
|
tMemTable() {}
|
||||||
|
quint64 mTotalSize;//B
|
||||||
|
quint64 mAvalableSize;//B
|
||||||
|
quint64 mNum;
|
||||||
|
QList<TMemInfo> mList;
|
||||||
|
} TMemTable;
|
||||||
|
|
||||||
|
typedef struct tCPUInfo
|
||||||
|
{
|
||||||
|
tCPUInfo() {}
|
||||||
|
quint64 mCoreNum;
|
||||||
|
quint64 mThreadNumPerCore;
|
||||||
|
quint64 mRate;
|
||||||
|
} TCPUInfo;
|
||||||
|
|
||||||
|
typedef struct tCPUTable
|
||||||
|
{
|
||||||
|
tCPUTable() {}
|
||||||
|
quint64 mNum;
|
||||||
|
QList<TCPUInfo> mList;
|
||||||
|
} TCPUTable;
|
||||||
|
|
||||||
|
class QQTSHARED_EXPORT QQtSystemInfo : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QQtSystemInfo ( QObject* parent = nullptr );
|
||||||
|
|
||||||
|
bool getCPUInfo ( TCPUTable& cpuInfo ) {
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
SYSTEM_INFO systemInfo;
|
||||||
|
GetSystemInfo ( &systemInfo );
|
||||||
|
|
||||||
|
TCPUInfo info;
|
||||||
|
info.mCoreNum = systemInfo.dwNumberOfProcessors;
|
||||||
|
cpuInfo.mNum = 1;
|
||||||
|
cpuInfo.mList.push_back ( info );
|
||||||
|
|
||||||
|
qDebug() << QStringLiteral ( "处理器掩码:" ) << systemInfo.dwActiveProcessorMask;
|
||||||
|
qDebug() << QStringLiteral ( "处理器个数:" ) << systemInfo.dwNumberOfProcessors;
|
||||||
|
qDebug() << QStringLiteral ( "处理器分页大小:" ) << systemInfo.dwPageSize;
|
||||||
|
qDebug() << QStringLiteral ( "处理器类型:" ) << systemInfo.dwProcessorType;
|
||||||
|
qDebug() << QStringLiteral ( "最大寻址单元:" ) << systemInfo.lpMaximumApplicationAddress;
|
||||||
|
qDebug() << QStringLiteral ( "最小寻址单元:" ) << systemInfo.lpMinimumApplicationAddress;
|
||||||
|
qDebug() << QStringLiteral ( "处理器等级:" ) << systemInfo.wProcessorLevel;
|
||||||
|
qDebug() << QStringLiteral ( "处理器版本:" ) << systemInfo.wProcessorRevision;
|
||||||
|
#else
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
bool getMEMInfo ( TMemTable& memInfo ) {
|
||||||
|
#if defined (Q_OS_WIN)
|
||||||
|
#define MB (1024 * 1024)
|
||||||
|
MEMORYSTATUSEX statex;
|
||||||
|
statex.dwLength = sizeof ( statex );
|
||||||
|
GlobalMemoryStatusEx ( &statex );
|
||||||
|
|
||||||
|
memInfo.mTotalSize = statex.ullTotalPhys;
|
||||||
|
memInfo.mAvalableSize = statex.ullAvailPhys;
|
||||||
|
memInfo.mNum = 1;
|
||||||
|
|
||||||
|
qDebug() << QStringLiteral ( "物理内存使用率:" ) << statex.dwMemoryLoad;
|
||||||
|
qDebug() << QStringLiteral ( "物理内存总量:" ) << statex.ullTotalPhys / MB;
|
||||||
|
qDebug() << QStringLiteral ( "可用的物理内存:" ) << statex.ullAvailPhys / MB;
|
||||||
|
qDebug() << QStringLiteral ( "系统页面文件大小:" ) << statex.ullTotalPageFile / MB;
|
||||||
|
qDebug() << QStringLiteral ( "系统可用页面文件大小:" ) << statex.ullAvailPageFile / MB;
|
||||||
|
qDebug() << QStringLiteral ( "虚拟内存总量:" ) << statex.ullTotalVirtual / MB;
|
||||||
|
qDebug() << QStringLiteral ( "可用的虚拟内存:" ) << statex.ullAvailVirtual / MB;
|
||||||
|
qDebug() << QStringLiteral ( "保留(值为0):" ) << statex.ullAvailExtendedVirtual / MB;
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
bool getDiskInfo ( TDiskTable& diskInfo ) {
|
||||||
|
#if defined (Q_OS_WIN)
|
||||||
|
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QQTSYSTEMINFO_H
|
@ -5,35 +5,6 @@
|
|||||||
#include "qqtmsgbox.h"
|
#include "qqtmsgbox.h"
|
||||||
#include "qqtethenetmanager.h"
|
#include "qqtethenetmanager.h"
|
||||||
|
|
||||||
bool tagWifi::isValid()
|
|
||||||
{
|
|
||||||
return wifi[ESSID_BSSID].isEmpty() ? false : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __MIPS_LINUX__
|
|
||||||
tagWifi& tagWifi::operator= ( tagWifi& w )
|
|
||||||
#else
|
|
||||||
tagWifi& tagWifi::operator= ( const tagWifi& w )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
for ( int i = ESSID_STATUS; i < ESSID_MAX; i++ )
|
|
||||||
wifi[i] = w[i];
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString& tagWifi::operator[] ( int index )
|
|
||||||
{
|
|
||||||
if ( index < ESSID_STATUS || index >= ESSID_MAX )
|
|
||||||
return wifi[0];
|
|
||||||
|
|
||||||
return wifi[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString& tagWifi::operator[] ( int index ) const
|
|
||||||
{
|
|
||||||
return operator [] ( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQtWiFiIdTextDelegate::drawCheck ( QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect,
|
void QQtWiFiIdTextDelegate::drawCheck ( QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect,
|
||||||
Qt::CheckState state ) const
|
Qt::CheckState state ) const
|
||||||
@ -187,7 +158,8 @@ void QQtWiFiWidget::clickWIFI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pline() << name << encryt << m_pass->wifiPwd();
|
pline() << name << encryt << m_pass->wifiPwd();
|
||||||
} while ( 0 );
|
}
|
||||||
|
while ( 0 );
|
||||||
|
|
||||||
QQtEthenetManager::Instance()->setRefresh();
|
QQtEthenetManager::Instance()->setRefresh();
|
||||||
}
|
}
|
||||||
|
@ -25,50 +25,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <qqt-local.h>
|
#include <qqt-local.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ESSID_STATUS = 0,
|
|
||||||
ESSID_NAME,//SSID
|
|
||||||
ESSID_TYPE,
|
|
||||||
ESSID_ENCRYP,
|
|
||||||
ESSID_PASS,
|
|
||||||
ESSID_BSSID,
|
|
||||||
ESSID_FREQ,
|
|
||||||
ESSID_SIGNAL,
|
|
||||||
ESSID_FLAG,
|
|
||||||
ESSID_MAX,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct QQTSHARED_EXPORT tagWifi
|
|
||||||
{
|
|
||||||
QString wifi[ESSID_MAX];
|
|
||||||
|
|
||||||
bool isValid();
|
|
||||||
|
|
||||||
/* only mips32 no use const, arm used
|
|
||||||
* 只有MIPS32不使用const,ARM32使用了。
|
|
||||||
*/
|
|
||||||
#ifdef __MIPS_LINUX__
|
|
||||||
tagWifi& operator= ( tagWifi& w );
|
|
||||||
#else
|
|
||||||
tagWifi& operator= ( const tagWifi& w );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const QString& operator[] ( int index ) const;
|
|
||||||
|
|
||||||
QString& operator[] ( int index );
|
|
||||||
} TWifi;
|
|
||||||
|
|
||||||
|
|
||||||
class QQTSHARED_EXPORT QQtWiFiIdTextDelegate : public QItemDelegate
|
class QQTSHARED_EXPORT QQtWiFiIdTextDelegate : public QItemDelegate
|
||||||
{
|
{
|
||||||
|
@ -12,53 +12,53 @@
|
|||||||
#include <qbluetoothdevicediscoveryagent.h>
|
#include <qbluetoothdevicediscoveryagent.h>
|
||||||
#include <qbluetoothservicediscoveryagent.h>
|
#include <qbluetoothservicediscoveryagent.h>
|
||||||
|
|
||||||
#include "qqt-local.h"
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
#include <qqtcore.h>
|
#include <qqtcore.h>
|
||||||
|
#include "qqt-local.h"
|
||||||
|
|
||||||
class QQTSHARED_EXPORT QQtBluetoothManager : public QBluetoothLocalDevice
|
class QQTSHARED_EXPORT QQtBluetoothManager : public QBluetoothLocalDevice
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static QQtBluetoothManager* Instance(QObject* parent = 0);
|
static QQtBluetoothManager* Instance ( QObject* parent = 0 );
|
||||||
/**
|
/**
|
||||||
* @brief changeAdapter
|
* @brief changeAdapter
|
||||||
* @param adapterAddress
|
* @param adapterAddress
|
||||||
* local device
|
* local device
|
||||||
*/
|
*/
|
||||||
void changeAdapter(QBluetoothAddress& adapterAddress);
|
void changeAdapter ( QBluetoothAddress& adapterAddress );
|
||||||
void powerOff();
|
void powerOff();
|
||||||
bool isPowerOn();
|
bool isPowerOn();
|
||||||
bool isDiscoverable();
|
bool isDiscoverable();
|
||||||
void setAutoScan(bool scan = true);
|
void setAutoScan ( bool scan = true );
|
||||||
void setDiscoverable(bool able = true);
|
void setDiscoverable ( bool able = true );
|
||||||
void refresh();
|
void refresh();
|
||||||
/**
|
/**
|
||||||
* @brief getDeviceList
|
* @brief getDeviceList
|
||||||
* remote device
|
* remote device
|
||||||
*/
|
*/
|
||||||
QList<QBluetoothDeviceInfo> getDeviceList();
|
QList<QBluetoothDeviceInfo> getDeviceList();
|
||||||
QList<QBluetoothServiceInfo> getServiceList(QBluetoothAddress& address);
|
QList<QBluetoothServiceInfo> getServiceList ( QBluetoothAddress& address );
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief addDevice
|
* @brief addDevice
|
||||||
* working signals
|
* working signals
|
||||||
*/
|
*/
|
||||||
void addDevice(QBluetoothDeviceInfo);
|
void addDevice ( QBluetoothDeviceInfo );
|
||||||
void deviceScanFinished();
|
void deviceScanFinished();
|
||||||
void addService(QBluetoothServiceInfo);
|
void addService ( QBluetoothServiceInfo );
|
||||||
void serviceScanFinished();
|
void serviceScanFinished();
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void slot_addDevice(QBluetoothDeviceInfo);
|
void slot_addDevice ( QBluetoothDeviceInfo );
|
||||||
void slot_addService(QBluetoothServiceInfo);
|
void slot_addService ( QBluetoothServiceInfo );
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
explicit QQtBluetoothManager(QObject* parent = nullptr);
|
explicit QQtBluetoothManager ( QObject* parent = nullptr );
|
||||||
static QQtBluetoothManager* _instance;
|
static QQtBluetoothManager* _instance;
|
||||||
|
|
||||||
QBluetoothDeviceDiscoveryAgent* deviceDiscoveryAgent;
|
QBluetoothDeviceDiscoveryAgent* deviceDiscoveryAgent;
|
||||||
|
@ -3,6 +3,36 @@
|
|||||||
#include "qqtcore.h"
|
#include "qqtcore.h"
|
||||||
#include "qqt-qt.h"
|
#include "qqt-qt.h"
|
||||||
|
|
||||||
|
bool tagWifi::isValid()
|
||||||
|
{
|
||||||
|
return wifi[ESSID_BSSID].isEmpty() ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __MIPS_LINUX__
|
||||||
|
tagWifi& tagWifi::operator= ( tagWifi& w )
|
||||||
|
#else
|
||||||
|
tagWifi& tagWifi::operator= ( const tagWifi& w )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
for ( int i = ESSID_STATUS; i < ESSID_MAX; i++ )
|
||||||
|
wifi[i] = w[i];
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString& tagWifi::operator[] ( int index )
|
||||||
|
{
|
||||||
|
if ( index < ESSID_STATUS || index >= ESSID_MAX )
|
||||||
|
return wifi[0];
|
||||||
|
|
||||||
|
return wifi[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& tagWifi::operator[] ( int index ) const
|
||||||
|
{
|
||||||
|
return operator [] ( index );
|
||||||
|
}
|
||||||
|
|
||||||
QQtEthenetManager* QQtEthenetManager::_instance = NULL;
|
QQtEthenetManager* QQtEthenetManager::_instance = NULL;
|
||||||
|
|
||||||
QQtEthenetManager* QQtEthenetManager::Instance ( QObject* parent )
|
QQtEthenetManager* QQtEthenetManager::Instance ( QObject* parent )
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user