update
parent
038cc37c12
commit
e5bdd36e27
|
@ -72,7 +72,7 @@ public:
|
||||||
|
|
||||||
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
|
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
|
||||||
{
|
{
|
||||||
setFlags( Qt::Window | Qt::FramelessWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
setFlag(Qt::FramelessWindowHint,true);
|
||||||
setResizeMode(SizeRootObjectToView);
|
setResizeMode(SizeRootObjectToView);
|
||||||
setIsMax(windowState() == Qt::WindowMaximized);
|
setIsMax(windowState() == Qt::WindowMaximized);
|
||||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
setIsFull(windowState() == Qt::WindowFullScreen);
|
||||||
|
@ -93,9 +93,6 @@ void FramelessView::showEvent(QShowEvent *e)
|
||||||
static const MARGINS shadow_state[2] { { 0, 0, 0, 0 }, { 1, 1, 1, 1 } };
|
static const MARGINS shadow_state[2] { { 0, 0, 0, 0 }, { 1, 1, 1, 1 } };
|
||||||
::DwmExtendFrameIntoClientArea((HWND)(winId()), &shadow_state[true]);
|
::DwmExtendFrameIntoClientArea((HWND)(winId()), &shadow_state[true]);
|
||||||
Super::showEvent(e);
|
Super::showEvent(e);
|
||||||
if(d->m_isFirst){
|
|
||||||
QTimer::singleShot(150,this,[=](){ setFlag(Qt::FramelessWindowHint,false); });
|
|
||||||
}
|
|
||||||
setFlag(Qt::FramelessWindowHint,false);
|
setFlag(Qt::FramelessWindowHint,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +160,8 @@ void FramelessView::setIsFull(bool isFull)
|
||||||
emit isFullChanged(d->m_isFull);
|
emit isFullChanged(d->m_isFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int count = 1;
|
||||||
|
|
||||||
void FramelessView::setTitleItem(QQuickItem *item)
|
void FramelessView::setTitleItem(QQuickItem *item)
|
||||||
{
|
{
|
||||||
d->m_titleItem = item;
|
d->m_titleItem = item;
|
||||||
|
@ -216,6 +215,15 @@ bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, long
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}else if (msg->message == WM_WINDOWPOSCHANGING)
|
||||||
|
{
|
||||||
|
WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(msg->lParam);
|
||||||
|
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0)
|
||||||
|
{
|
||||||
|
wp->flags |= SWP_NOCOPYBITS;
|
||||||
|
*result = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Super::nativeEvent(eventType, message, result);
|
return Super::nativeEvent(eventType, message, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ Rectangle{
|
||||||
return parent.width
|
return parent.width
|
||||||
}
|
}
|
||||||
z: 65535
|
z: 65535
|
||||||
clip: true
|
|
||||||
|
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: if (tapCount === 2) toggleMaximized()
|
onTapped: if (tapCount === 2) toggleMaximized()
|
||||||
|
|
Loading…
Reference in New Issue