mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-29 22:55:56 +08:00
update
This commit is contained in:
parent
65905b139e
commit
e5668869b9
@ -62,23 +62,23 @@ void FluFrameless::classBegin(){
|
|||||||
void FluFrameless::updateCursor(int edges){
|
void FluFrameless::updateCursor(int edges){
|
||||||
switch (edges) {
|
switch (edges) {
|
||||||
case 0:
|
case 0:
|
||||||
qApp->restoreOverrideCursor();
|
_window->setCursor(Qt::ArrowCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge:
|
case Qt::LeftEdge:
|
||||||
case Qt::RightEdge:
|
case Qt::RightEdge:
|
||||||
qApp->setOverrideCursor(QCursor(Qt::SizeHorCursor));
|
_window->setCursor(Qt::SizeHorCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::TopEdge:
|
case Qt::TopEdge:
|
||||||
case Qt::BottomEdge:
|
case Qt::BottomEdge:
|
||||||
qApp->setOverrideCursor(QCursor(Qt::SizeVerCursor));
|
_window->setCursor(Qt::SizeVerCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge | Qt::TopEdge:
|
case Qt::LeftEdge | Qt::TopEdge:
|
||||||
case Qt::RightEdge | Qt::BottomEdge:
|
case Qt::RightEdge | Qt::BottomEdge:
|
||||||
qApp->setOverrideCursor(QCursor(Qt::SizeFDiagCursor));
|
_window->setCursor(Qt::SizeFDiagCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::RightEdge | Qt::TopEdge:
|
case Qt::RightEdge | Qt::TopEdge:
|
||||||
case Qt::LeftEdge | Qt::BottomEdge:
|
case Qt::LeftEdge | Qt::BottomEdge:
|
||||||
qApp->setOverrideCursor(QCursor(Qt::SizeBDiagCursor));
|
_window->setCursor(Qt::SizeBDiagCursor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +105,6 @@ bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){
|
|||||||
if(_window->width() == _window->maximumWidth() && _window->width() == _window->minimumWidth() && _window->height() == _window->maximumHeight() && _window->height() == _window->minimumHeight()){
|
if(_window->width() == _window->maximumWidth() && _window->width() == _window->minimumWidth() && _window->height() == _window->maximumHeight() && _window->height() == _window->minimumHeight()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
edges = 0;
|
|
||||||
QMouseEvent *event = static_cast<QMouseEvent*>(ev);
|
QMouseEvent *event = static_cast<QMouseEvent*>(ev);
|
||||||
QPoint p =
|
QPoint p =
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||||
@ -113,6 +112,14 @@ bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){
|
|||||||
#else
|
#else
|
||||||
event->position().toPoint();
|
event->position().toPoint();
|
||||||
#endif
|
#endif
|
||||||
|
if(p.x() >= margin && p.x() <= (_window->width() - margin) && p.y() >= margin && p.y() <= (_window->height() - margin)){
|
||||||
|
if(edges != 0){
|
||||||
|
edges = 0;
|
||||||
|
updateCursor(edges);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
edges = 0;
|
||||||
if ( p.x() < margin ) {
|
if ( p.x() < margin ) {
|
||||||
edges |= Qt::LeftEdge;
|
edges |= Qt::LeftEdge;
|
||||||
}
|
}
|
||||||
@ -145,8 +152,12 @@ void FluFrameless::componentComplete(){
|
|||||||
_window->setFlag(Qt::FramelessWindowHint,true);
|
_window->setFlag(Qt::FramelessWindowHint,true);
|
||||||
_window->installEventFilter(this);
|
_window->installEventFilter(this);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
qDebug()<<"---------";
|
||||||
_nativeEvent =new FramelessEventFilter(_window);
|
_nativeEvent =new FramelessEventFilter(_window);
|
||||||
qApp->installNativeEventFilter(_nativeEvent);
|
qApp->installNativeEventFilter(_nativeEvent);
|
||||||
|
HWND hWnd = reinterpret_cast<HWND>(_window->winId());
|
||||||
|
ULONG_PTR cNewStyle = GetClassLongPtr(hWnd, GCL_STYLE) | CS_DROPSHADOW;
|
||||||
|
SetClassLongPtr(hWnd, GCL_STYLE, cNewStyle);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,9 @@ Window {
|
|||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
useSystemAppBar = FluApp.useSystemAppBar
|
useSystemAppBar = FluApp.useSystemAppBar
|
||||||
|
if(!useSystemAppBar){
|
||||||
|
loader_frameless.sourceComponent = com_frameless
|
||||||
|
}
|
||||||
lifecycle.onCompleted(window)
|
lifecycle.onCompleted(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
if(window.autoMaximize){
|
if(window.autoMaximize){
|
||||||
@ -89,7 +92,7 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluLoader{
|
FluLoader{
|
||||||
sourceComponent: window.useSystemAppBar ? undefined : com_frameless
|
id:loader_frameless
|
||||||
}
|
}
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
|
@ -64,6 +64,9 @@ Window {
|
|||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
useSystemAppBar = FluApp.useSystemAppBar
|
useSystemAppBar = FluApp.useSystemAppBar
|
||||||
|
if(!useSystemAppBar){
|
||||||
|
loader_frameless.sourceComponent = com_frameless
|
||||||
|
}
|
||||||
lifecycle.onCompleted(window)
|
lifecycle.onCompleted(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
if(window.autoMaximize){
|
if(window.autoMaximize){
|
||||||
@ -88,7 +91,7 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluLoader{
|
FluLoader{
|
||||||
sourceComponent: window.useSystemAppBar ? undefined : com_frameless
|
id:loader_frameless
|
||||||
}
|
}
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
|
Loading…
Reference in New Issue
Block a user