- change UI layout to make it looks like the default style of Windows image browser. - update icons to material design icon for better looks. add lost icons for those new added button at the bottom bar. - restore window style to normal. remove borderless style. - delete X button at the right-top corner. disable feature that drag window to move, because all functions provided by native window are restored. - move prev next image button to the center of bottom bar. - move navigator view to the right-bottom corner so that it will not overlay on the shown image. - remove all animation effect, including alpha transition, fade out when exiting and etc. - delete function that double click windows to exit. now double clicking windows will do nothing. change default value of double click behavior to do nothing. - change default value of stay on top to false because stay on top is not the default behavior of Windows image browser.
32 lines
933 B
C++
32 lines
933 B
C++
// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
|
|
// SPDX-FileCopyrightText: 2023 Tad Young <yyc12321@outlook.com>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include "framelesswindow.h"
|
|
|
|
#include <QMouseEvent>
|
|
#include <QHoverEvent>
|
|
#include <QApplication>
|
|
#include <QVBoxLayout>
|
|
#include <QWindow>
|
|
|
|
FramelessWindow::FramelessWindow(QWidget *parent)
|
|
: QWidget(parent)
|
|
, m_centralLayout(new QVBoxLayout(this))
|
|
{
|
|
this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
m_centralLayout->setContentsMargins(QMargins(0, 0, 0, 60));
|
|
}
|
|
|
|
void FramelessWindow::setCentralWidget(QWidget *widget)
|
|
{
|
|
if (m_centralWidget) {
|
|
m_centralLayout->removeWidget(m_centralWidget);
|
|
m_centralWidget->deleteLater();
|
|
}
|
|
|
|
m_centralLayout->addWidget(widget);
|
|
m_centralWidget = widget;
|
|
}
|