2020-06-04 14:26:51 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#include "window/window_title_qt.h"
|
|
|
|
|
2020-07-10 23:06:19 +00:00
|
|
|
#include "platform/platform_specific.h"
|
2020-08-28 12:24:54 +00:00
|
|
|
#include "base/platform/base_platform_info.h"
|
2020-08-28 12:07:29 +00:00
|
|
|
#include "ui/platform/ui_platform_utility.h"
|
2020-06-04 14:26:51 +00:00
|
|
|
#include "ui/widgets/buttons.h"
|
|
|
|
#include "ui/widgets/shadow.h"
|
2020-07-18 05:06:29 +00:00
|
|
|
#include "core/core_settings.h"
|
|
|
|
#include "core/application.h"
|
2020-06-04 14:26:51 +00:00
|
|
|
#include "styles/style_window.h"
|
2020-08-28 12:07:29 +00:00
|
|
|
#include "styles/style_calls.h" // st::callShadow
|
2020-07-07 17:33:34 +00:00
|
|
|
#include "base/call_delayed.h"
|
2020-06-04 14:26:51 +00:00
|
|
|
|
|
|
|
#include <QtGui/QGuiApplication>
|
|
|
|
#include <QtGui/QWindow>
|
2020-10-12 20:37:55 +00:00
|
|
|
#include <QtWidgets/QApplication>
|
2020-06-04 14:26:51 +00:00
|
|
|
|
|
|
|
namespace Window {
|
2020-07-07 17:33:34 +00:00
|
|
|
namespace {
|
|
|
|
|
2020-10-02 13:17:53 +00:00
|
|
|
[[nodiscard]] style::margins ShadowExtents() {
|
2020-08-28 12:07:29 +00:00
|
|
|
return st::callShadow.extend;
|
|
|
|
}
|
|
|
|
|
2020-07-07 17:33:34 +00:00
|
|
|
} // namespace
|
2020-06-04 14:26:51 +00:00
|
|
|
|
|
|
|
TitleWidgetQt::TitleWidgetQt(QWidget *parent)
|
|
|
|
: TitleWidget(parent)
|
|
|
|
, _st(st::defaultWindowTitle)
|
|
|
|
, _minimize(this, _st.minimize)
|
|
|
|
, _maximizeRestore(this, _st.maximize)
|
|
|
|
, _close(this, _st.close)
|
|
|
|
, _shadow(this, st::titleShadow)
|
|
|
|
, _maximizedState(parent->window()->windowState() & Qt::WindowMaximized) {
|
|
|
|
_minimize->setClickedCallback([=] {
|
|
|
|
window()->setWindowState(
|
|
|
|
window()->windowState() | Qt::WindowMinimized);
|
|
|
|
_minimize->clearState();
|
|
|
|
});
|
|
|
|
_minimize->setPointerCursor(false);
|
|
|
|
_maximizeRestore->setClickedCallback([=] {
|
|
|
|
window()->setWindowState(_maximizedState
|
|
|
|
? Qt::WindowNoState
|
|
|
|
: Qt::WindowMaximized);
|
|
|
|
_maximizeRestore->clearState();
|
|
|
|
});
|
|
|
|
_maximizeRestore->setPointerCursor(false);
|
|
|
|
_close->setClickedCallback([=] {
|
|
|
|
window()->close();
|
|
|
|
_close->clearState();
|
|
|
|
});
|
|
|
|
_close->setPointerCursor(false);
|
|
|
|
|
2020-07-18 05:06:29 +00:00
|
|
|
Core::App().settings().windowControlsLayoutChanges(
|
|
|
|
) | rpl::start_with_next([=] {
|
|
|
|
updateControlsPosition();
|
|
|
|
}, lifetime());
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
QCoreApplication::instance()->installEventFilter(this);
|
|
|
|
|
2020-08-28 12:07:29 +00:00
|
|
|
_windowWasFrameless = (window()->windowFlags()
|
|
|
|
& Qt::FramelessWindowHint) != 0;
|
|
|
|
|
2020-07-07 17:33:34 +00:00
|
|
|
if (!_windowWasFrameless) {
|
|
|
|
toggleFramelessWindow(true);
|
|
|
|
}
|
2020-08-28 12:07:29 +00:00
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
|
|
|
resize(width(), _st.height);
|
2020-08-28 12:07:29 +00:00
|
|
|
|
|
|
|
updateWindowExtents();
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
|
2020-07-07 17:33:34 +00:00
|
|
|
TitleWidgetQt::~TitleWidgetQt() {
|
|
|
|
restoreCursor();
|
2020-08-28 21:00:09 +00:00
|
|
|
|
2020-07-07 17:33:34 +00:00
|
|
|
if (!_windowWasFrameless) {
|
|
|
|
toggleFramelessWindow(false);
|
|
|
|
}
|
2020-08-28 21:00:09 +00:00
|
|
|
|
|
|
|
if (_extentsSet) {
|
|
|
|
Platform::UnsetWindowExtents(window()->windowHandle());
|
|
|
|
}
|
2020-07-07 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::toggleFramelessWindow(bool enabled) {
|
|
|
|
// setWindowFlag calls setParent(parentWidget(), newFlags), which
|
|
|
|
// always calls hide() explicitly, we have to show() the window back.
|
|
|
|
const auto top = window();
|
|
|
|
const auto hidden = top->isHidden();
|
|
|
|
top->setWindowFlag(Qt::FramelessWindowHint, enabled);
|
|
|
|
if (!hidden) {
|
|
|
|
base::call_delayed(
|
2020-10-02 14:29:28 +00:00
|
|
|
kShowAfterWindowFlagChangeDelay,
|
2020-07-07 17:33:34 +00:00
|
|
|
top,
|
|
|
|
[=] { top->show(); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
void TitleWidgetQt::init() {
|
|
|
|
connect(
|
|
|
|
window()->windowHandle(),
|
|
|
|
&QWindow::windowStateChanged,
|
|
|
|
this,
|
|
|
|
[=](Qt::WindowState state) { windowStateChanged(state); });
|
2020-08-28 12:07:29 +00:00
|
|
|
connect(
|
|
|
|
window()->windowHandle(),
|
|
|
|
&QWindow::visibleChanged,
|
|
|
|
this,
|
|
|
|
[=](bool visible) { visibleChanged(visible); });
|
2020-06-04 14:26:51 +00:00
|
|
|
_maximizedState = (window()->windowState() & Qt::WindowMaximized);
|
|
|
|
_activeState = isActiveWindow();
|
|
|
|
updateButtonsState();
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:07:29 +00:00
|
|
|
bool TitleWidgetQt::hasShadow() const {
|
|
|
|
const auto center = window()->geometry().center();
|
|
|
|
return Platform::WindowsNeedShadow()
|
|
|
|
&& Ui::Platform::TranslucentWindowsSupported(center);
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
void TitleWidgetQt::paintEvent(QPaintEvent *e) {
|
|
|
|
auto active = isActiveWindow();
|
|
|
|
if (_activeState != active) {
|
|
|
|
_activeState = active;
|
|
|
|
updateButtonsState();
|
|
|
|
}
|
|
|
|
Painter(this).fillRect(rect(), active ? _st.bgActive : _st.bg);
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:07:29 +00:00
|
|
|
void TitleWidgetQt::updateWindowExtents() {
|
2020-08-28 21:00:09 +00:00
|
|
|
if (hasShadow()) {
|
|
|
|
if (!_maximizedState) {
|
|
|
|
Platform::SetWindowExtents(
|
|
|
|
window()->windowHandle(),
|
|
|
|
ShadowExtents());
|
|
|
|
} else {
|
|
|
|
Platform::SetWindowExtents(
|
|
|
|
window()->windowHandle(),
|
|
|
|
QMargins());
|
|
|
|
}
|
|
|
|
|
|
|
|
_extentsSet = true;
|
|
|
|
} else if (_extentsSet) {
|
|
|
|
Platform::UnsetWindowExtents(window()->windowHandle());
|
|
|
|
_extentsSet = false;
|
2020-08-28 12:07:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
void TitleWidgetQt::updateControlsPosition() {
|
2020-07-18 05:06:29 +00:00
|
|
|
const auto controlsLayout = Core::App().settings().windowControlsLayout();
|
|
|
|
const auto controlsLeft = controlsLayout.left;
|
|
|
|
const auto controlsRight = controlsLayout.right;
|
|
|
|
|
|
|
|
if (ranges::contains(controlsLeft, Control::Minimize)
|
|
|
|
|| ranges::contains(controlsRight, Control::Minimize)) {
|
|
|
|
_minimize->show();
|
|
|
|
} else {
|
|
|
|
_minimize->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ranges::contains(controlsLeft, Control::Maximize)
|
|
|
|
|| ranges::contains(controlsRight, Control::Maximize)) {
|
|
|
|
_maximizeRestore->show();
|
|
|
|
} else {
|
|
|
|
_maximizeRestore->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ranges::contains(controlsLeft, Control::Close)
|
|
|
|
|| ranges::contains(controlsRight, Control::Close)) {
|
|
|
|
_close->show();
|
|
|
|
} else {
|
|
|
|
_close->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
updateControlsPositionBySide(controlsLeft, false);
|
|
|
|
updateControlsPositionBySide(controlsRight, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::updateControlsPositionBySide(
|
|
|
|
const std::vector<Control> &controls,
|
|
|
|
bool right) {
|
|
|
|
const auto preparedControls = right
|
|
|
|
? (ranges::view::reverse(controls) | ranges::to_vector)
|
|
|
|
: controls;
|
|
|
|
|
|
|
|
auto position = 0;
|
|
|
|
for (const auto &control : preparedControls) {
|
|
|
|
switch (control) {
|
|
|
|
case Control::Minimize:
|
|
|
|
if (right) {
|
|
|
|
_minimize->moveToRight(position, 0);
|
|
|
|
} else {
|
|
|
|
_minimize->moveToLeft(position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
position += _minimize->width();
|
|
|
|
break;
|
|
|
|
case Control::Maximize:
|
|
|
|
if (right) {
|
|
|
|
_maximizeRestore->moveToRight(position, 0);
|
|
|
|
} else {
|
|
|
|
_maximizeRestore->moveToLeft(position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
position += _maximizeRestore->width();
|
|
|
|
break;
|
|
|
|
case Control::Close:
|
|
|
|
if (right) {
|
|
|
|
_close->moveToRight(position, 0);
|
|
|
|
} else {
|
|
|
|
_close->moveToLeft(position, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
position += _close->width();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::resizeEvent(QResizeEvent *e) {
|
|
|
|
updateControlsPosition();
|
|
|
|
_shadow->setGeometry(0, height() - st::lineWidth, width(), st::lineWidth);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::mousePressEvent(QMouseEvent *e) {
|
2020-08-07 21:59:45 +00:00
|
|
|
if (e->button() == Qt::LeftButton) {
|
2020-10-12 20:37:55 +00:00
|
|
|
if ((crl::now() - _pressedForMoveTime)
|
|
|
|
< QApplication::doubleClickInterval()) {
|
|
|
|
if (_maximizedState) {
|
|
|
|
window()->setWindowState(Qt::WindowNoState);
|
|
|
|
} else {
|
|
|
|
window()->setWindowState(Qt::WindowMaximized);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_pressedForMove = true;
|
|
|
|
_pressedForMoveTime = crl::now();
|
|
|
|
_pressedForMovePoint = e->windowPos().toPoint();
|
|
|
|
}
|
2020-08-07 21:59:45 +00:00
|
|
|
} else if (e->button() == Qt::RightButton) {
|
|
|
|
Platform::ShowWindowMenu(window()->windowHandle());
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:37:55 +00:00
|
|
|
void TitleWidgetQt::mouseReleaseEvent(QMouseEvent *e) {
|
|
|
|
if (e->button() == Qt::LeftButton) {
|
|
|
|
_pressedForMove = false;
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TitleWidgetQt::eventFilter(QObject *obj, QEvent *e) {
|
|
|
|
if (e->type() == QEvent::MouseMove
|
|
|
|
|| e->type() == QEvent::MouseButtonPress) {
|
2020-07-07 17:33:34 +00:00
|
|
|
if (window()->isAncestorOf(static_cast<QWidget*>(obj))) {
|
2020-06-04 14:26:51 +00:00
|
|
|
const auto mouseEvent = static_cast<QMouseEvent*>(e);
|
2020-10-12 20:37:55 +00:00
|
|
|
const auto currentPoint = mouseEvent->windowPos().toPoint();
|
|
|
|
const auto edges = edgesFromPos(currentPoint);
|
|
|
|
const auto dragDistance = QApplication::startDragDistance();
|
2020-06-04 14:26:51 +00:00
|
|
|
|
2020-07-31 02:38:21 +00:00
|
|
|
if (e->type() == QEvent::MouseMove
|
|
|
|
&& mouseEvent->buttons() == Qt::NoButton) {
|
2020-10-12 20:37:55 +00:00
|
|
|
if (_pressedForMove) {
|
|
|
|
_pressedForMove = false;
|
|
|
|
}
|
|
|
|
|
2020-07-01 14:28:33 +00:00
|
|
|
updateCursor(edges);
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
|
2020-10-12 20:37:55 +00:00
|
|
|
if (e->type() == QEvent::MouseMove
|
|
|
|
&& _pressedForMove
|
|
|
|
&& ((currentPoint - _pressedForMovePoint).manhattanLength()
|
|
|
|
>= dragDistance)) {
|
|
|
|
return startMove();
|
|
|
|
}
|
|
|
|
|
2020-07-07 17:33:34 +00:00
|
|
|
if (e->type() == QEvent::MouseButtonPress
|
2020-06-04 14:26:51 +00:00
|
|
|
&& mouseEvent->button() == Qt::LeftButton
|
2020-08-28 12:07:29 +00:00
|
|
|
&& !_maximizedState) {
|
2020-07-01 14:28:33 +00:00
|
|
|
return startResize(edges);
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
2020-06-30 11:24:00 +00:00
|
|
|
} else if (e->type() == QEvent::Leave) {
|
|
|
|
if (window() == static_cast<QWidget*>(obj)) {
|
2020-07-07 17:33:34 +00:00
|
|
|
restoreCursor();
|
2020-06-30 11:24:00 +00:00
|
|
|
}
|
2020-08-28 12:24:54 +00:00
|
|
|
} else if (e->type() == QEvent::Move
|
|
|
|
|| e->type() == QEvent::Resize) {
|
|
|
|
if (window() == static_cast<QWidget*>(obj)) {
|
|
|
|
updateWindowExtents();
|
|
|
|
}
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TitleWidget::eventFilter(obj, e);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::windowStateChanged(Qt::WindowState state) {
|
|
|
|
if (state == Qt::WindowMinimized) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto maximized = (state == Qt::WindowMaximized);
|
|
|
|
if (_maximizedState != maximized) {
|
|
|
|
_maximizedState = maximized;
|
|
|
|
updateButtonsState();
|
2020-08-28 15:43:23 +00:00
|
|
|
updateWindowExtents();
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:07:29 +00:00
|
|
|
void TitleWidgetQt::visibleChanged(bool visible) {
|
|
|
|
if (visible) {
|
|
|
|
updateWindowExtents();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
void TitleWidgetQt::updateButtonsState() {
|
|
|
|
_minimize->setIconOverride(_activeState
|
|
|
|
? &_st.minimizeIconActive
|
|
|
|
: nullptr,
|
|
|
|
_activeState
|
|
|
|
? &_st.minimizeIconActiveOver
|
|
|
|
: nullptr);
|
|
|
|
if (_maximizedState) {
|
|
|
|
_maximizeRestore->setIconOverride(
|
|
|
|
_activeState
|
|
|
|
? &_st.restoreIconActive : &_st.restoreIcon,
|
|
|
|
_activeState
|
|
|
|
? &_st.restoreIconActiveOver
|
|
|
|
: &_st.restoreIconOver);
|
|
|
|
} else {
|
|
|
|
_maximizeRestore->setIconOverride(_activeState
|
|
|
|
? &_st.maximizeIconActive
|
|
|
|
: nullptr,
|
|
|
|
_activeState
|
|
|
|
? &_st.maximizeIconActiveOver
|
|
|
|
: nullptr);
|
|
|
|
}
|
|
|
|
_close->setIconOverride(_activeState
|
|
|
|
? &_st.closeIconActive
|
|
|
|
: nullptr,
|
|
|
|
_activeState
|
|
|
|
? &_st.closeIconActiveOver
|
|
|
|
: nullptr);
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:07:29 +00:00
|
|
|
int TitleWidgetQt::getResizeArea(Qt::Edge edge) const {
|
|
|
|
if (!hasShadow()) {
|
|
|
|
return st::windowResizeArea;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (edge == Qt::LeftEdge) {
|
|
|
|
return ShadowExtents().left();
|
|
|
|
} else if (edge == Qt::RightEdge) {
|
|
|
|
return ShadowExtents().right();
|
|
|
|
} else if (edge == Qt::TopEdge) {
|
|
|
|
return ShadowExtents().top();
|
|
|
|
} else if (edge == Qt::BottomEdge) {
|
|
|
|
return ShadowExtents().bottom();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
Qt::Edges TitleWidgetQt::edgesFromPos(const QPoint &pos) {
|
2020-08-28 12:07:29 +00:00
|
|
|
if (pos.x() <= getResizeArea(Qt::LeftEdge)) {
|
|
|
|
if (pos.y() <= getResizeArea(Qt::TopEdge)) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::LeftEdge | Qt::TopEdge;
|
2020-08-28 12:07:29 +00:00
|
|
|
} else if (pos.y()
|
|
|
|
>= (window()->height() - getResizeArea(Qt::BottomEdge))) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::LeftEdge | Qt::BottomEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Qt::LeftEdge;
|
2020-08-28 12:07:29 +00:00
|
|
|
} else if (pos.x()
|
|
|
|
>= (window()->width() - getResizeArea(Qt::RightEdge))) {
|
|
|
|
if (pos.y() <= getResizeArea(Qt::TopEdge)) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::RightEdge | Qt::TopEdge;
|
2020-08-28 12:07:29 +00:00
|
|
|
} else if (pos.y()
|
|
|
|
>= (window()->height() - getResizeArea(Qt::BottomEdge))) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::RightEdge | Qt::BottomEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Qt::RightEdge;
|
2020-08-28 12:07:29 +00:00
|
|
|
} else if (pos.y() <= getResizeArea(Qt::TopEdge)) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::TopEdge;
|
2020-08-28 12:07:29 +00:00
|
|
|
} else if (pos.y()
|
|
|
|
>= (window()->height() - getResizeArea(Qt::BottomEdge))) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::BottomEdge;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-07 17:33:34 +00:00
|
|
|
void TitleWidgetQt::restoreCursor() {
|
|
|
|
if (_cursorOverriden) {
|
|
|
|
_cursorOverriden = false;
|
|
|
|
QGuiApplication::restoreOverrideCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-01 14:28:33 +00:00
|
|
|
void TitleWidgetQt::updateCursor(Qt::Edges edges) {
|
2020-08-28 12:07:29 +00:00
|
|
|
if (!edges || _maximizedState) {
|
2020-07-07 17:33:34 +00:00
|
|
|
restoreCursor();
|
2020-06-04 14:26:51 +00:00
|
|
|
return;
|
|
|
|
} else if (!QGuiApplication::overrideCursor()) {
|
2020-07-07 17:33:34 +00:00
|
|
|
_cursorOverriden = false;
|
|
|
|
}
|
|
|
|
if (!_cursorOverriden) {
|
|
|
|
_cursorOverriden = true;
|
2020-06-04 14:26:51 +00:00
|
|
|
QGuiApplication::setOverrideCursor(QCursor());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((edges & Qt::LeftEdge) && (edges & Qt::TopEdge))
|
|
|
|
|| ((edges & Qt::RightEdge) && (edges & Qt::BottomEdge))) {
|
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeFDiagCursor));
|
|
|
|
} else if (((edges & Qt::LeftEdge) && (edges & Qt::BottomEdge))
|
|
|
|
|| ((edges & Qt::RightEdge) && (edges & Qt::TopEdge))) {
|
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeBDiagCursor));
|
|
|
|
} else if ((edges & Qt::LeftEdge) || (edges & Qt::RightEdge)) {
|
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeHorCursor));
|
|
|
|
} else if ((edges & Qt::TopEdge) || (edges & Qt::BottomEdge)) {
|
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeVerCursor));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-10 23:06:19 +00:00
|
|
|
bool TitleWidgetQt::startMove() {
|
|
|
|
if (Platform::StartSystemMove(window()->windowHandle())) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED
|
2020-07-10 23:06:19 +00:00
|
|
|
if (window()->windowHandle()->startSystemMove()) {
|
|
|
|
return true;
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
#endif // Qt >= 5.15 || DESKTOP_APP_QT_PATCHED
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-07-10 23:06:19 +00:00
|
|
|
bool TitleWidgetQt::startResize(Qt::Edges edges) {
|
|
|
|
if (edges) {
|
|
|
|
if (Platform::StartSystemResize(window()->windowHandle(), edges)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED
|
|
|
|
if (window()->windowHandle()->startSystemResize(edges)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif // Qt >= 5.15 || DESKTOP_APP_QT_PATCHED
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
} // namespace Window
|