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