mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 05:38:37 +08:00
update
This commit is contained in:
parent
b22e79148b
commit
5d902dc66e
@ -19,6 +19,7 @@ Window {
|
|||||||
}
|
}
|
||||||
request.headers["token"] ="yyds"
|
request.headers["token"] ="yyds"
|
||||||
request.headers["os"] ="pc"
|
request.headers["os"] ="pc"
|
||||||
|
console.debug(JSON.stringify(request))
|
||||||
return request
|
return request
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ CustomWindow {
|
|||||||
//Stack模式,每次切换都会将页面压入栈中,随着栈的页面增多,消耗的内存也越多,内存消耗多就会卡顿,这时候就需要按返回将页面pop掉,释放内存。该模式可以配合FluPage中的launchMode属性,设置页面的启动模式
|
//Stack模式,每次切换都会将页面压入栈中,随着栈的页面增多,消耗的内存也越多,内存消耗多就会卡顿,这时候就需要按返回将页面pop掉,释放内存。该模式可以配合FluPage中的launchMode属性,设置页面的启动模式
|
||||||
pageMode: FluNavigationViewType.Stack
|
pageMode: FluNavigationViewType.Stack
|
||||||
//NoStack模式,每次切换都会销毁之前的页面然后创建一个新的页面,只需消耗少量内存(推荐)
|
//NoStack模式,每次切换都会销毁之前的页面然后创建一个新的页面,只需消耗少量内存(推荐)
|
||||||
// pageMode: FluNavigationViewType.NoStack
|
// pageMode: FluNavigationViewType.NoStack
|
||||||
items: ItemsOriginal
|
items: ItemsOriginal
|
||||||
footerItems:ItemsFooter
|
footerItems:ItemsFooter
|
||||||
topPadding:FluTools.isMacos() ? 20 : 5
|
topPadding:FluTools.isMacos() ? 20 : 5
|
||||||
@ -201,14 +201,26 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component{
|
||||||
|
id:com_reveal
|
||||||
CircularReveal{
|
CircularReveal{
|
||||||
id:reveal
|
id:reveal
|
||||||
target:window.contentItem
|
target:window.contentItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
onAnimationFinished:{
|
||||||
|
//动画结束后释放资源
|
||||||
|
loader_reveal.sourceComponent = undefined
|
||||||
|
}
|
||||||
onImageChanged: {
|
onImageChanged: {
|
||||||
changeDark()
|
changeDark()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader{
|
||||||
|
id:loader_reveal
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
function distance(x1,y1,x2,y2){
|
function distance(x1,y1,x2,y2){
|
||||||
return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
|
return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
|
||||||
@ -218,11 +230,13 @@ CustomWindow {
|
|||||||
if(FluTools.isMacos() || !FluTheme.enableAnimation){
|
if(FluTools.isMacos() || !FluTheme.enableAnimation){
|
||||||
changeDark()
|
changeDark()
|
||||||
}else{
|
}else{
|
||||||
|
loader_reveal.sourceComponent = com_reveal
|
||||||
var target = window.contentItem
|
var target = window.contentItem
|
||||||
var pos = button.mapToItem(target,0,0)
|
var pos = button.mapToItem(target,0,0)
|
||||||
var mouseX = pos.x
|
var mouseX = pos.x
|
||||||
var mouseY = pos.y
|
var mouseY = pos.y
|
||||||
var radius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
var radius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
||||||
|
var reveal = loader_reveal.item
|
||||||
reveal.start(reveal.width*Screen.devicePixelRatio,reveal.height*Screen.devicePixelRatio,Qt.point(mouseX,mouseY),radius)
|
reveal.start(reveal.width*Screen.devicePixelRatio,reveal.height*Screen.devicePixelRatio,Qt.point(mouseX,mouseY),radius)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,5 +259,4 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,12 @@
|
|||||||
CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent)
|
CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
_anim = new QPropertyAnimation(this, "radius", this);
|
_anim.setDuration(333);
|
||||||
_anim->setDuration(333);
|
_anim.setEasingCurve(QEasingCurve::OutCubic);
|
||||||
_anim->setEasingCurve(QEasingCurve::OutCubic);
|
connect(&_anim, &QPropertyAnimation::finished,this,[=](){
|
||||||
connect(_anim, &QPropertyAnimation::finished,this,[=](){
|
update();
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
Q_EMIT animationFinished();
|
||||||
});
|
});
|
||||||
connect(this,&CircularReveal::radiusChanged,this,[=](){
|
connect(this,&CircularReveal::radiusChanged,this,[=](){
|
||||||
update();
|
update();
|
||||||
@ -31,8 +32,8 @@ void CircularReveal::paint(QPainter* painter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CircularReveal::start(int w,int h,const QPoint& center,int radius){
|
void CircularReveal::start(int w,int h,const QPoint& center,int radius){
|
||||||
_anim->setStartValue(0);
|
_anim.setStartValue(0);
|
||||||
_anim->setEndValue(radius);
|
_anim.setEndValue(radius);
|
||||||
_center = center;
|
_center = center;
|
||||||
_grabResult = _target->grabToImage(QSize(w,h));
|
_grabResult = _target->grabToImage(QSize(w,h));
|
||||||
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult);
|
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult);
|
||||||
@ -43,5 +44,5 @@ void CircularReveal::handleGrabResult(){
|
|||||||
update();
|
update();
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
Q_EMIT imageChanged();
|
Q_EMIT imageChanged();
|
||||||
_anim->start();
|
_anim.start();
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,11 @@ public:
|
|||||||
void paint(QPainter* painter) override;
|
void paint(QPainter* painter) override;
|
||||||
Q_INVOKABLE void start(int w,int h,const QPoint& center,int radius);
|
Q_INVOKABLE void start(int w,int h,const QPoint& center,int radius);
|
||||||
Q_SIGNAL void imageChanged();
|
Q_SIGNAL void imageChanged();
|
||||||
|
Q_SIGNAL void animationFinished();
|
||||||
Q_SLOT void handleGrabResult();
|
Q_SLOT void handleGrabResult();
|
||||||
private:
|
private:
|
||||||
QImage _source;
|
QImage _source;
|
||||||
QPropertyAnimation* _anim;
|
QPropertyAnimation _anim = QPropertyAnimation(this, "radius", this);
|
||||||
QPoint _center;
|
QPoint _center;
|
||||||
QSharedPointer<QQuickItemGrabResult> _grabResult;
|
QSharedPointer<QQuickItemGrabResult> _grabResult;
|
||||||
};
|
};
|
||||||
|
@ -204,13 +204,11 @@ void FluHttp::download(QString path,QVariantMap params,QVariantMap headers){
|
|||||||
addQueryParam(&url,data["params"].toMap());
|
addQueryParam(&url,data["params"].toMap());
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
addHeaders(&request,data["headers"].toMap());
|
addHeaders(&request,data["headers"].toMap());
|
||||||
QFile *file = new QFile(path);
|
QSharedPointer<QFile> file(new QFile(path));
|
||||||
QIODevice::OpenMode mode = QIODevice::WriteOnly|QIODevice::Truncate;
|
QIODevice::OpenMode mode = QIODevice::WriteOnly|QIODevice::Truncate;
|
||||||
if (!file->open(mode))
|
if (!file->open(mode))
|
||||||
{
|
{
|
||||||
Q_EMIT error(-1,QString("Url: %1 %2 Non-Writable").arg(request.url().toString(),file->fileName()));
|
Q_EMIT error(-1,QString("Url: %1 %2 Non-Writable").arg(request.url().toString(),file->fileName()));
|
||||||
file->deleteLater();
|
|
||||||
file = nullptr;
|
|
||||||
Q_EMIT finish();
|
Q_EMIT finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -234,9 +232,7 @@ void FluHttp::download(QString path,QVariantMap params,QVariantMap headers){
|
|||||||
}
|
}
|
||||||
_cache.removeOne(reply);
|
_cache.removeOne(reply);
|
||||||
file->close();
|
file->close();
|
||||||
file->deleteLater();
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
file = nullptr;
|
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
Q_EMIT finish();
|
Q_EMIT finish();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user