You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import QtQuick 2.7
import FishUI 1.0 as FishUI
Rectangle {
id: root
color: "transparent"
border.width: 2
border.color: FishUI . Theme . highlightColor
width: parent . width
height: parent . height
property var control: parent
DragRect {
posType: posLeftTop
onPosChange: {
//不要简化这个判断条件,至少让以后维护的人能看懂。化简过后我自己都看不懂了。
if ( control . x + xOffset < control . x + control . width )
control . x += xOffset ;
if ( control . y + yOffset < control . y + control . height )
control . y += yOffset ;
if ( control . width - xOffset > 0 )
control . width -= xOffset ;
if ( control . height - yOffset > 0 )
control . height -= yOffset ;
}
}
DragRect {
posType: posRightTop
x: parent . width - width
onPosChange: {
//向左拖动时, xOffset为负数
if ( control . width + xOffset > 0 )
control . width += xOffset ;
if ( control . height - yOffset > 0 )
control . height -= yOffset ;
if ( control . y + yOffset < control . y + control . height )
control . y += yOffset ;
}
}
DragRect {
posType: posLeftBottom
y: parent . height - height
onPosChange: {
if ( control . x + xOffset < control . x + control . width )
control . x += xOffset ;
if ( control . width - xOffset > 0 )
control . width -= xOffset ;
if ( control . height + yOffset > 0 )
control . height += yOffset ;
}
}
DragRect {
posType: posRightBottom
x: parent . width - width
y: parent . height - height
onPosChange: {
if ( control . width + xOffset > 0 )
control . width += xOffset ;
if ( control . height + yOffset > 0 )
control . height += yOffset ;
}
}
}