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-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"
|
2021-02-03 10:43:31 +00:00
|
|
|
#include "styles/style_widgets.h"
|
2020-06-04 14:26:51 +00:00
|
|
|
#include "styles/style_window.h"
|
|
|
|
|
2021-02-02 13:03:00 +00:00
|
|
|
#include <QtCore/QCoreApplication>
|
2021-02-03 05:34:37 +00:00
|
|
|
#include <QtGui/QGuiApplication>
|
2020-06-04 14:26:51 +00:00
|
|
|
#include <QtGui/QWindow>
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-02-07 13:32:35 +00:00
|
|
|
template <typename T>
|
|
|
|
void RemoveDuplicates(std::vector<T> &v) {
|
|
|
|
auto end = v.end();
|
|
|
|
for (auto it = v.begin(); it != end; ++it) {
|
|
|
|
end = std::remove(it + 1, end, *it);
|
|
|
|
}
|
|
|
|
|
|
|
|
v.erase(end, v.end());
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2021-02-19 04:26:46 +00:00
|
|
|
Ui::Platform::TitleControlsLayoutChanged(
|
2020-07-18 05:06:29 +00:00
|
|
|
) | 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() {
|
2021-02-03 05:34:37 +00:00
|
|
|
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) {
|
2021-02-19 04:26:46 +00:00
|
|
|
Ui::Platform::UnsetWindowExtents(window()->windowHandle());
|
2020-08-28 21:00:09 +00:00
|
|
|
}
|
2020-07-07 17:33:34 +00:00
|
|
|
}
|
|
|
|
|
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();
|
2021-02-19 04:26:46 +00:00
|
|
|
return Ui::Platform::WindowExtentsSupported()
|
2020-08-28 12:07:29 +00:00
|
|
|
&& Ui::Platform::TranslucentWindowsSupported(center);
|
|
|
|
}
|
|
|
|
|
2021-02-06 14:16:44 +00:00
|
|
|
Ui::IconButton *TitleWidgetQt::controlWidget(Control control) const {
|
|
|
|
switch (control) {
|
|
|
|
case Control::Minimize: return _minimize;
|
|
|
|
case Control::Maximize: return _maximizeRestore;
|
|
|
|
case Control::Close: return _close;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2021-02-02 13:03:00 +00:00
|
|
|
void TitleWidgetQt::toggleFramelessWindow(bool enabled) {
|
|
|
|
window()->windowHandle()->setFlag(Qt::FramelessWindowHint, enabled);
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:07:29 +00:00
|
|
|
void TitleWidgetQt::updateWindowExtents() {
|
2020-08-28 21:00:09 +00:00
|
|
|
if (hasShadow()) {
|
2021-02-19 04:26:46 +00:00
|
|
|
Ui::Platform::SetWindowExtents(
|
2021-02-02 13:03:00 +00:00
|
|
|
window()->windowHandle(),
|
2021-02-21 04:07:43 +00:00
|
|
|
resizeArea());
|
2020-08-28 21:00:09 +00:00
|
|
|
|
|
|
|
_extentsSet = true;
|
|
|
|
} else if (_extentsSet) {
|
2021-02-19 04:26:46 +00:00
|
|
|
Ui::Platform::UnsetWindowExtents(window()->windowHandle());
|
2020-08-28 21:00:09 +00:00
|
|
|
_extentsSet = false;
|
2020-08-28 12:07:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
void TitleWidgetQt::updateControlsPosition() {
|
2021-02-19 04:26:46 +00:00
|
|
|
const auto controlsLayout = Ui::Platform::TitleControlsLayout();
|
2020-07-18 05:06:29 +00:00
|
|
|
const auto controlsLeft = controlsLayout.left;
|
|
|
|
const auto controlsRight = controlsLayout.right;
|
|
|
|
|
2021-02-06 14:16:44 +00:00
|
|
|
const auto controlPresent = [&](Control control) {
|
|
|
|
return ranges::contains(controlsLeft, control)
|
|
|
|
|| ranges::contains(controlsRight, control);
|
|
|
|
};
|
|
|
|
|
|
|
|
if (controlPresent(Control::Minimize)) {
|
2020-07-18 05:06:29 +00:00
|
|
|
_minimize->show();
|
|
|
|
} else {
|
|
|
|
_minimize->hide();
|
|
|
|
}
|
|
|
|
|
2021-02-06 14:16:44 +00:00
|
|
|
if (controlPresent(Control::Maximize)) {
|
2020-07-18 05:06:29 +00:00
|
|
|
_maximizeRestore->show();
|
|
|
|
} else {
|
|
|
|
_maximizeRestore->hide();
|
|
|
|
}
|
|
|
|
|
2021-02-06 14:16:44 +00:00
|
|
|
if (controlPresent(Control::Close)) {
|
2020-07-18 05:06:29 +00:00
|
|
|
_close->show();
|
|
|
|
} else {
|
|
|
|
_close->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
updateControlsPositionBySide(controlsLeft, false);
|
|
|
|
updateControlsPositionBySide(controlsRight, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::updateControlsPositionBySide(
|
|
|
|
const std::vector<Control> &controls,
|
|
|
|
bool right) {
|
2021-02-07 13:32:35 +00:00
|
|
|
auto preparedControls = right
|
2020-07-18 05:06:29 +00:00
|
|
|
? (ranges::view::reverse(controls) | ranges::to_vector)
|
|
|
|
: controls;
|
|
|
|
|
2021-02-07 13:32:35 +00:00
|
|
|
RemoveDuplicates(preparedControls);
|
|
|
|
|
2020-07-18 05:06:29 +00:00
|
|
|
auto position = 0;
|
|
|
|
for (const auto &control : preparedControls) {
|
2021-02-06 14:16:44 +00:00
|
|
|
const auto widget = controlWidget(control);
|
|
|
|
if (!widget) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (right) {
|
|
|
|
widget->moveToRight(position, 0);
|
|
|
|
} else {
|
|
|
|
widget->moveToLeft(position, 0);
|
2020-07-18 05:06:29 +00:00
|
|
|
}
|
2021-02-06 14:16:44 +00:00
|
|
|
|
|
|
|
position += widget->width();
|
2020-07-18 05:06:29 +00:00
|
|
|
}
|
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) {
|
2021-02-02 13:03:00 +00:00
|
|
|
_mousePressed = true;
|
2020-08-07 21:59:45 +00:00
|
|
|
} else if (e->button() == Qt::RightButton) {
|
2021-02-19 04:26:46 +00:00
|
|
|
Ui::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) {
|
2021-02-02 13:03:00 +00:00
|
|
|
_mousePressed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::mouseMoveEvent(QMouseEvent *e) {
|
|
|
|
if (_mousePressed) {
|
2021-02-19 04:26:46 +00:00
|
|
|
window()->windowHandle()->startSystemMove();
|
2021-02-02 13:03:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::mouseDoubleClickEvent(QMouseEvent *e) {
|
|
|
|
if (_maximizedState) {
|
|
|
|
window()->setWindowState(Qt::WindowNoState);
|
|
|
|
} else {
|
|
|
|
window()->setWindowState(Qt::WindowMaximized);
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TitleWidgetQt::eventFilter(QObject *obj, QEvent *e) {
|
|
|
|
if (e->type() == QEvent::MouseMove
|
|
|
|
|| e->type() == QEvent::MouseButtonPress) {
|
2021-01-26 16:38:15 +00:00
|
|
|
if (obj->isWidgetType()
|
|
|
|
&& 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);
|
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) {
|
2021-03-05 15:05:30 +00:00
|
|
|
if (_mousePressed) {
|
|
|
|
_mousePressed = false;
|
|
|
|
}
|
|
|
|
|
2020-07-01 14:28:33 +00:00
|
|
|
updateCursor(edges);
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
|
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
|
2021-02-02 13:03:00 +00:00
|
|
|
&& edges) {
|
2021-02-19 04:26:46 +00:00
|
|
|
return window()->windowHandle()->startSystemResize(edges);
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-03 05:34:37 +00:00
|
|
|
} else if (e->type() == QEvent::Leave) {
|
|
|
|
if (obj->isWidgetType() && window() == static_cast<QWidget*>(obj)) {
|
|
|
|
restoreCursor();
|
|
|
|
}
|
2020-08-28 12:24:54 +00:00
|
|
|
} else if (e->type() == QEvent::Move
|
|
|
|
|| e->type() == QEvent::Resize) {
|
2021-01-26 16:38:15 +00:00
|
|
|
if (obj->isWidgetType() && window() == static_cast<QWidget*>(obj)) {
|
2020-08-28 12:24:54 +00:00
|
|
|
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();
|
2021-01-12 15:35:32 +00:00
|
|
|
|
|
|
|
// workaround a bug in Qt 5.12, works ok in Qt 5.15
|
|
|
|
// https://github.com/telegramdesktop/tdesktop/issues/10119
|
|
|
|
if (!_windowWasFrameless) {
|
|
|
|
toggleFramelessWindow(true);
|
|
|
|
}
|
2020-08-28 12:07:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2021-02-02 13:03:00 +00:00
|
|
|
QMargins TitleWidgetQt::resizeArea() const {
|
|
|
|
if (_maximizedState) {
|
|
|
|
return QMargins();
|
|
|
|
} else if (!hasShadow()) {
|
|
|
|
return QMargins(
|
|
|
|
st::windowResizeArea,
|
|
|
|
st::windowResizeArea,
|
|
|
|
st::windowResizeArea,
|
|
|
|
st::windowResizeArea);
|
2020-08-28 12:07:29 +00:00
|
|
|
}
|
|
|
|
|
2021-02-02 13:03:00 +00:00
|
|
|
return ShadowExtents();
|
2020-08-28 12:07:29 +00:00
|
|
|
}
|
|
|
|
|
2021-02-02 13:03:00 +00:00
|
|
|
Qt::Edges TitleWidgetQt::edgesFromPos(const QPoint &pos) const {
|
2021-02-17 18:04:52 +00:00
|
|
|
const auto area = resizeArea();
|
|
|
|
|
|
|
|
if (area.isNull()) {
|
|
|
|
return Qt::Edges();
|
|
|
|
} else if (pos.x() <= area.left()) {
|
|
|
|
if (pos.y() <= area.top()) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::LeftEdge | Qt::TopEdge;
|
2021-02-17 18:04:52 +00:00
|
|
|
} else if (pos.y() >= (window()->height() - area.bottom())) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::LeftEdge | Qt::BottomEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Qt::LeftEdge;
|
2021-02-17 18:04:52 +00:00
|
|
|
} else if (pos.x() >= (window()->width() - area.right())) {
|
|
|
|
if (pos.y() <= area.top()) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::RightEdge | Qt::TopEdge;
|
2021-02-17 18:04:52 +00:00
|
|
|
} else if (pos.y() >= (window()->height() - area.bottom())) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::RightEdge | Qt::BottomEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Qt::RightEdge;
|
2021-02-17 18:04:52 +00:00
|
|
|
} else if (pos.y() <= area.top()) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::TopEdge;
|
2021-02-17 18:04:52 +00:00
|
|
|
} else if (pos.y() >= (window()->height() - area.bottom())) {
|
2020-06-04 14:26:51 +00:00
|
|
|
return Qt::BottomEdge;
|
|
|
|
}
|
2021-02-17 18:04:52 +00:00
|
|
|
|
|
|
|
return Qt::Edges();
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
|
2020-07-01 14:28:33 +00:00
|
|
|
void TitleWidgetQt::updateCursor(Qt::Edges edges) {
|
2021-02-03 05:34:37 +00:00
|
|
|
if (!edges) {
|
|
|
|
restoreCursor();
|
|
|
|
return;
|
|
|
|
} else if (!QGuiApplication::overrideCursor()) {
|
|
|
|
_cursorOverriden = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_cursorOverriden) {
|
|
|
|
_cursorOverriden = true;
|
|
|
|
QGuiApplication::setOverrideCursor(QCursor());
|
|
|
|
}
|
|
|
|
|
2020-06-04 14:26:51 +00:00
|
|
|
if (((edges & Qt::LeftEdge) && (edges & Qt::TopEdge))
|
|
|
|
|| ((edges & Qt::RightEdge) && (edges & Qt::BottomEdge))) {
|
2021-02-03 05:34:37 +00:00
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeFDiagCursor));
|
2020-06-04 14:26:51 +00:00
|
|
|
} else if (((edges & Qt::LeftEdge) && (edges & Qt::BottomEdge))
|
|
|
|
|| ((edges & Qt::RightEdge) && (edges & Qt::TopEdge))) {
|
2021-02-03 05:34:37 +00:00
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeBDiagCursor));
|
2020-06-04 14:26:51 +00:00
|
|
|
} else if ((edges & Qt::LeftEdge) || (edges & Qt::RightEdge)) {
|
2021-02-03 05:34:37 +00:00
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeHorCursor));
|
2020-06-04 14:26:51 +00:00
|
|
|
} else if ((edges & Qt::TopEdge) || (edges & Qt::BottomEdge)) {
|
2021-02-03 05:34:37 +00:00
|
|
|
QGuiApplication::changeOverrideCursor(QCursor(Qt::SizeVerCursor));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWidgetQt::restoreCursor() {
|
|
|
|
if (_cursorOverriden) {
|
|
|
|
_cursorOverriden = false;
|
|
|
|
QGuiApplication::restoreOverrideCursor();
|
2020-06-04 14:26:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Window
|