├── .gitignore
├── L2AutoHideWidget
├── L2AutoHideWidget.pro
├── close.svg
├── l2dialog.cpp
├── l2dialog.h
├── l2dialog.ui
├── l2framelessmainwindow.cpp
├── l2framelessmainwindow.h
├── l2framelessmainwindow.ui
├── l2mainwindow.cpp
├── l2mainwindow.h
├── l2mainwindow.ui
├── l2windowtitlebar.cpp
├── l2windowtitlebar.h
├── main.cpp
└── resource.qrc
├── LICENSE
├── README.md
└── frameless_mainwindow.gif
/.gitignore:
--------------------------------------------------------------------------------
1 | build-*/
2 | *.pro.user
--------------------------------------------------------------------------------
/L2AutoHideWidget/L2AutoHideWidget.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2019-08-22T23:34:24
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10 |
11 | TARGET = L2AutoHideWidget
12 | TEMPLATE = app
13 |
14 | # The following define makes your compiler emit warnings if you use
15 | # any feature of Qt which has been marked as deprecated (the exact warnings
16 | # depend on your compiler). Please consult the documentation of the
17 | # deprecated API in order to know how to port your code away from it.
18 | DEFINES += QT_DEPRECATED_WARNINGS
19 |
20 | # You can also make your code fail to compile if you use deprecated APIs.
21 | # In order to do so, uncomment the following line.
22 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
24 |
25 | CONFIG += c++11
26 |
27 | SOURCES += \
28 | l2framelessmainwindow.cpp \
29 | l2mainwindow.cpp \
30 | l2windowtitlebar.cpp \
31 | main.cpp \
32 | l2dialog.cpp
33 |
34 | HEADERS += \
35 | l2framelessmainwindow.h \
36 | l2mainwindow.h \
37 | l2windowtitlebar.h \
38 | l2dialog.h
39 |
40 | FORMS += \
41 | l2framelessmainwindow.ui \
42 | l2mainwindow.ui \
43 | l2dialog.ui
44 |
45 | # Default rules for deployment.
46 | qnx: target.path = /tmp/$${TARGET}/bin
47 | else: unix:!android: target.path = /opt/$${TARGET}/bin
48 | !isEmpty(target.path): INSTALLS += target
49 |
50 | RESOURCES += \
51 | resource.qrc
52 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/close.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2dialog.cpp:
--------------------------------------------------------------------------------
1 | #include "l2dialog.h"
2 | #include "ui_l2dialog.h"
3 |
4 | L2Dialog::L2Dialog(QWidget *parent) :
5 | QDialog(parent),
6 | ui(new Ui::L2Dialog)
7 | {
8 | ui->setupUi(this);
9 | }
10 |
11 | L2Dialog::~L2Dialog()
12 | {
13 | delete ui;
14 | }
15 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2dialog.h:
--------------------------------------------------------------------------------
1 | #ifndef L2DIALOG_H
2 | #define L2DIALOG_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class L2Dialog;
8 | }
9 |
10 | class L2Dialog : public QDialog
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit L2Dialog(QWidget *parent = 0);
16 | ~L2Dialog();
17 |
18 | private:
19 | Ui::L2Dialog *ui;
20 | };
21 |
22 | #endif // L2DIALOG_H
23 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2dialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | L2Dialog
6 |
7 |
8 |
9 | 0
10 | 0
11 | 400
12 | 300
13 |
14 |
15 |
16 | Dialog
17 |
18 |
19 |
20 |
21 | 30
22 | 240
23 | 341
24 | 32
25 |
26 |
27 |
28 | Qt::Horizontal
29 |
30 |
31 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | buttonBox
40 | accepted()
41 | L2Dialog
42 | accept()
43 |
44 |
45 | 248
46 | 254
47 |
48 |
49 | 157
50 | 274
51 |
52 |
53 |
54 |
55 | buttonBox
56 | rejected()
57 | L2Dialog
58 | reject()
59 |
60 |
61 | 316
62 | 260
63 |
64 |
65 | 286
66 | 274
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2framelessmainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "l2framelessmainwindow.h"
2 | #include "ui_l2framelessmainwindow.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "l2dialog.h"
9 |
10 | L2FramelessMainWindow::L2FramelessMainWindow(QWidget *parent) :
11 | QMainWindow(parent),
12 | ui(new Ui::L2FramelessMainWindow)
13 | {
14 | ui->setupUi(this);
15 | ui->windowTitleBar->SetMainWindow(this);
16 |
17 | ui->comboBox->addItems(QStringList{ "A", "B", "C", "D" });
18 |
19 | setWindowFlags(Qt::FramelessWindowHint);
20 |
21 | #ifdef Q_OS_LINUX
22 | setWindowFlags(this->windowFlags() | Qt::X11BypassWindowManagerHint);
23 | #endif
24 |
25 | // 获取屏幕宽度
26 | mScreenWidth = QApplication::primaryScreen()->geometry().width();
27 |
28 | #ifdef Q_OS_LINUX
29 | move(pos() + QApplication::primaryScreen()->geometry().center() - this->geometry().center());
30 | #endif
31 | }
32 |
33 | L2FramelessMainWindow::~L2FramelessMainWindow()
34 | {
35 | delete ui;
36 | }
37 |
38 | void L2FramelessMainWindow::leaveEvent(QEvent *event)
39 | {
40 | bool shouldHide = false;
41 | if (mDirection == Direction::Up) {
42 | shouldHide = (this->y() <= 0);
43 | } else if (mDirection == Direction::Left) {
44 | shouldHide = (this->x() <= 0);
45 | } else if (mDirection == Direction::Right) {
46 | shouldHide = (this->x() >= (mScreenWidth - this->width()));
47 | }
48 | if (shouldHide) {
49 | hideWidget();
50 | mHideFlag = true;
51 | } else {
52 | mHideFlag = false;
53 | }
54 | QWidget::leaveEvent(event);
55 | }
56 |
57 | void L2FramelessMainWindow::enterEvent(QEvent *event)
58 | {
59 | if (mHideFlag) {
60 | showWidget();
61 | }
62 | QWidget::enterEvent(event);
63 | }
64 |
65 | void L2FramelessMainWindow::moveEvent(QMoveEvent *event)
66 | {
67 | if (qApp->mouseButtons() == Qt::LeftButton) {
68 | if (this->y() < 0) {
69 | mDirection = Direction::Up;
70 | move(this->x(), 0);
71 | }
72 | if (this->x() < 0) {
73 | mDirection = Direction::Left;
74 | move(0, this->y());
75 | }
76 | if (this->x() > (mScreenWidth - this->width())) {
77 | mDirection = Direction::Right;
78 | move(mScreenWidth - this->width(), this->y());
79 | }
80 | }
81 | QWidget::moveEvent(event);
82 | }
83 |
84 | void L2FramelessMainWindow::showEvent(QShowEvent *event)
85 | {
86 | #ifdef Q_OS_LINUX
87 | this->activateWindow();
88 | #endif
89 | QWidget::showEvent(event);
90 | }
91 |
92 | void L2FramelessMainWindow::hideWidget()
93 | {
94 | QPoint startPos = this->pos();
95 | QPoint endPos;
96 | if (mDirection == Direction::Up) {
97 | endPos = QPoint(this->x(), -this->height() + 1);
98 | } else if (mDirection == Direction::Left) {
99 | endPos = QPoint(-this->width() + 1, this->y());
100 | } else if (mDirection == Direction::Right) {
101 | endPos = QPoint(mScreenWidth - 1, this->y());
102 | }
103 |
104 | if (startPos == endPos) {
105 | return;
106 | }
107 |
108 | QPropertyAnimation *anim = new QPropertyAnimation(this, "pos", this);
109 | connect(anim, &QAbstractAnimation::finished, [this](){
110 | // Note: This function calls setParent() when changing the flags for a window,
111 | // causing the widget to be hidden.
112 | // You must call show() to make the widget visible again..
113 | setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
114 | show();
115 | });
116 | anim->setDuration(200);
117 | anim->setStartValue(startPos);
118 | anim->setEndValue(endPos);
119 | anim->setEasingCurve(QEasingCurve::InQuad);
120 | anim->start(QAbstractAnimation::DeleteWhenStopped);
121 | }
122 |
123 | void L2FramelessMainWindow::showWidget()
124 | {
125 | QPoint startPos = this->pos();
126 | QPoint endPos;
127 | if (mDirection == Direction::Up) {
128 | endPos = QPoint(this->x(), 0);
129 | } else if (mDirection == Direction::Left) {
130 | endPos = QPoint(0, this->y());
131 | } else if (mDirection == Direction::Right) {
132 | endPos = QPoint(mScreenWidth - this->width(), this->y());
133 | }
134 |
135 | if (startPos == endPos) {
136 | return;
137 | }
138 |
139 | // Note: This function calls setParent() when changing the flags for a window,
140 | // causing the widget to be hidden.
141 | // You must call show() to make the widget visible again..
142 | setWindowFlags(this->windowFlags() & ~Qt::WindowStaysOnTopHint);
143 | show();
144 |
145 | QPropertyAnimation *anim = new QPropertyAnimation(this, "pos", this);
146 | anim->setDuration(200);
147 | anim->setStartValue(startPos);
148 | anim->setEndValue(endPos);
149 | anim->setEasingCurve(QEasingCurve::OutQuad);
150 | anim->start(QAbstractAnimation::DeleteWhenStopped);
151 | }
152 |
153 | void L2FramelessMainWindow::on_pushButton_clicked()
154 | {
155 | L2Dialog dialog;
156 | #ifdef Q_OS_LINUX
157 | dialog.setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
158 | #endif
159 | dialog.exec();
160 | }
161 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2framelessmainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef FRAMELESSMAINWINDOW_H
2 | #define FRAMELESSMAINWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class L2FramelessMainWindow;
8 | }
9 |
10 | class L2FramelessMainWindow : public QMainWindow
11 | {
12 | Q_OBJECT
13 | public:
14 | enum Direction {
15 | Up = 0,
16 | Left,
17 | Right
18 | };
19 | public:
20 | explicit L2FramelessMainWindow(QWidget *parent = nullptr);
21 | ~L2FramelessMainWindow();
22 |
23 | protected:
24 | void leaveEvent(QEvent *event) override;
25 | void enterEvent(QEvent *event) override;
26 | void moveEvent(QMoveEvent *event) override;
27 | void showEvent(QShowEvent *event) override;
28 |
29 | private slots:
30 | void on_pushButton_clicked();
31 |
32 | private:
33 | void hideWidget();
34 | void showWidget();
35 |
36 | private:
37 | Ui::L2FramelessMainWindow *ui;
38 | int mScreenWidth;
39 | Direction mDirection;
40 | bool mHideFlag = false;
41 | };
42 |
43 | #endif // FRAMELESSMAINWINDOW_H
44 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2framelessmainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | L2FramelessMainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 468
10 | 600
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | 0
26 |
27 |
28 | 0
29 |
30 |
31 | 0
32 |
33 |
34 | 0
35 |
36 |
37 | 0
38 |
39 | -
40 |
41 |
42 |
43 | 0
44 | 60
45 |
46 |
47 |
48 |
49 | 16777215
50 | 60
51 |
52 |
53 |
54 | background-color: rgb(0, 170, 127);
55 |
56 |
57 |
58 | -
59 |
60 |
61 |
62 |
63 |
64 |
-
65 |
66 |
67 | -
68 |
69 |
70 | -
71 |
72 |
73 | -
74 |
75 |
76 | -
77 |
78 |
79 | -
80 |
81 |
82 | -
83 |
84 |
85 | -
86 |
87 |
88 | -
89 |
90 |
91 | Show Dialog
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | Open
103 |
104 |
105 |
106 |
107 | Save
108 |
109 |
110 |
111 |
112 | Save As
113 |
114 |
115 |
116 |
117 | Close
118 |
119 |
120 |
121 |
122 | Help
123 |
124 |
125 |
126 |
127 | About
128 |
129 |
130 |
131 |
132 |
133 | L2WindowTitleBar
134 | QWidget
135 |
136 | 1
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "l2mainwindow.h"
2 | #include "ui_l2mainwindow.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | L2MainWindow::L2MainWindow(QWidget *parent) :
10 | QMainWindow(parent),
11 | ui(new Ui::L2MainWindow)
12 | {
13 | ui->setupUi(this);
14 |
15 | // 禁止最大化按钮
16 | setWindowFlags(this->windowFlags() & ~Qt::WindowMaximizeButtonHint);
17 |
18 | // 获取屏幕宽度
19 | mScreenWidth = QApplication::primaryScreen()->geometry().width();
20 |
21 | // 由于leaveEvent与enterEnter对系统边框部分失效
22 | // 因此增加定时器监测鼠标所在点是否在窗口区域内
23 | mTimer = new QTimer(this);
24 | connect(mTimer, SIGNAL(timeout()), this, SLOT(onTimeout()));
25 | mTimer->start(100);
26 | }
27 |
28 | L2MainWindow::~L2MainWindow()
29 | {
30 | delete ui;
31 | }
32 |
33 | void L2MainWindow::moveEvent(QMoveEvent *event)
34 | {
35 | if (qApp->mouseButtons() == Qt::LeftButton) {
36 | mIsMoving = true;
37 | if (this->y() < 0) {
38 | mDirection = Direction::Up;
39 | move(this->x(), 0);
40 | mIsMoving = false;
41 | } else if (this->x() < 0) {
42 | mDirection = Direction::Left;
43 | move(0, this->y());
44 | mIsMoving = false;
45 | } else if (this->x() > (mScreenWidth - this->frameGeometry().width())) {
46 | mDirection = Direction::Right;
47 | move(mScreenWidth-this->width(), this->y());
48 | mIsMoving = false;
49 | }
50 | }
51 | QWidget::moveEvent(event);
52 | }
53 |
54 | void L2MainWindow::hideWidget()
55 | {
56 | QPoint startPos = this->pos();
57 | QPoint endPos;
58 | if (mDirection == Direction::Up) {
59 | endPos = QPoint(this->x(), -this->frameGeometry().height() + 2);
60 | } else if (mDirection == Direction::Left) {
61 | endPos = QPoint(-this->frameGeometry().width() + 2, this->y());
62 | } else if (mDirection == Direction::Right) {
63 | endPos = QPoint(mScreenWidth - 2, this->y());
64 | }
65 |
66 | if (startPos == endPos) {
67 | return;
68 | }
69 |
70 | QPropertyAnimation *anim = new QPropertyAnimation(this, "pos", this);
71 | connect(anim, &QAbstractAnimation::finished, [this](){
72 | // Note: This function calls setParent() when changing the flags for a window,
73 | // causing the widget to be hidden.
74 | // You must call show() to make the widget visible again..
75 | setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
76 | show();
77 | });
78 | anim->setDuration(100);
79 | anim->setStartValue(startPos);
80 | anim->setEndValue(endPos);
81 | anim->setEasingCurve(QEasingCurve::InQuad);
82 | anim->start(QAbstractAnimation::DeleteWhenStopped);
83 | }
84 |
85 | void L2MainWindow::showWidget()
86 | {
87 | QPoint startPos = this->pos();
88 | QPoint endPos;
89 | if (mDirection == Direction::Up) {
90 | endPos = QPoint(this->x(), 0);
91 | } else if (mDirection == Direction::Left) {
92 | endPos = QPoint(0, this->y());
93 | } else if (mDirection == Direction::Right) {
94 | endPos = QPoint(mScreenWidth - this->frameGeometry().width(), this->y());
95 | }
96 |
97 | if (startPos == endPos) {
98 | return;
99 | }
100 |
101 | // Note: This function calls setParent() when changing the flags for a window,
102 | // causing the widget to be hidden.
103 | // You must call show() to make the widget visible again..
104 | setWindowFlags(this->windowFlags() & ~Qt::WindowStaysOnTopHint);
105 | show();
106 |
107 | QPropertyAnimation *anim = new QPropertyAnimation(this, "pos", this);
108 | anim->setDuration(100);
109 | anim->setStartValue(startPos);
110 | anim->setEndValue(endPos);
111 | anim->setEasingCurve(QEasingCurve::OutQuad);
112 | anim->start(QAbstractAnimation::DeleteWhenStopped);
113 | }
114 |
115 | void L2MainWindow::on_actionClose_triggered()
116 | {
117 | qApp->quit();
118 | }
119 |
120 | void L2MainWindow::onTimeout()
121 | {
122 | if (mIsMoving) {
123 | return;
124 | }
125 | if (this->frameGeometry().contains(QCursor::pos())) {
126 | // 如果鼠标点在窗口区域内
127 | // 且已经隐藏,则显示窗口
128 | if (mHideFlag) {
129 | mHideFlag = false;
130 | showWidget();
131 | }
132 | } else {
133 | // 如果鼠标点不在窗口区域内
134 | // 判断是否贴边需要自动隐藏
135 | bool shouldHide = false;
136 | if (mDirection == Direction::Up) {
137 | shouldHide = (this->y() <= 0);
138 | } else if (mDirection == Direction::Left) {
139 | shouldHide = (this->x() <= 0);
140 | } else if (mDirection == Direction::Right) {
141 | shouldHide = (this->x() >= (mScreenWidth - this->frameGeometry().width()));
142 | }
143 | if (shouldHide) {
144 | mHideFlag = true;
145 | hideWidget();
146 | } else {
147 | mHideFlag = false;
148 | }
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class L2MainWindow;
8 | }
9 |
10 | class QTimer;
11 |
12 | class L2MainWindow : public QMainWindow
13 | {
14 | Q_OBJECT
15 | public:
16 | enum Direction {
17 | Up = 0,
18 | Left,
19 | Right
20 | };
21 | public:
22 | explicit L2MainWindow(QWidget *parent = nullptr);
23 | ~L2MainWindow();
24 |
25 | protected:
26 | void moveEvent(QMoveEvent *event) override;
27 |
28 | private slots:
29 | void on_actionClose_triggered();
30 | void onTimeout();
31 |
32 | private:
33 | void hideWidget();
34 | void showWidget();
35 |
36 | private:
37 | Ui::L2MainWindow *ui;
38 | int mScreenWidth;
39 | Direction mDirection;
40 | bool mHideFlag = false;
41 | bool mIsMoving = false;
42 | QTimer *mTimer = nullptr;
43 | };
44 |
45 | #endif // MAINWINDOW_H
46 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | L2MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 541
10 | 472
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 | background-color: rgb(99, 149, 149);
20 |
21 |
22 | -
23 |
24 |
25 |
26 | Agency FB
27 | 72
28 |
29 |
30 |
31 | L2
32 |
33 |
34 | Qt::AlignCenter
35 |
36 |
37 |
38 |
39 |
40 |
65 |
66 |
67 | TopToolBarArea
68 |
69 |
70 | false
71 |
72 |
73 |
74 |
75 |
76 | Close
77 |
78 |
79 |
80 |
81 | About
82 |
83 |
84 |
85 |
86 | Help
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2windowtitlebar.cpp:
--------------------------------------------------------------------------------
1 | #include "l2windowtitlebar.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | L2WindowTitleBar::L2WindowTitleBar(QWidget *parent)
9 | : QWidget (parent)
10 | {
11 | QHBoxLayout *layout = new QHBoxLayout(this);
12 | layout->addStretch(1);
13 | QToolButton *closeButton = new QToolButton(this);
14 | connect(closeButton, &QToolButton::clicked, [](){
15 | qApp->quit();
16 | });
17 | closeButton->setIcon(QIcon(":/close.svg"));
18 | layout->addWidget(closeButton);
19 | }
20 |
21 | L2WindowTitleBar::~L2WindowTitleBar()
22 | {
23 |
24 | }
25 |
26 | void L2WindowTitleBar::SetMainWindow(QMainWindow *mainwindow)
27 | {
28 | mMainWindow = mainwindow;
29 | }
30 |
31 | void L2WindowTitleBar::mousePressEvent(QMouseEvent *event)
32 | {
33 | mClickPos = event->globalPos() - mMainWindow->pos();
34 | }
35 |
36 | void L2WindowTitleBar::mouseMoveEvent(QMouseEvent *event)
37 | {
38 | if (event->buttons() == Qt::RightButton) {
39 | return;
40 | }
41 | mMainWindow->move(event->globalPos() - mClickPos);
42 | }
43 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/l2windowtitlebar.h:
--------------------------------------------------------------------------------
1 | #ifndef L2MOVEABLEMENUBAR_H
2 | #define L2MOVEABLEMENUBAR_H
3 |
4 | #include
5 | #include
6 |
7 | class QMainWindow;
8 |
9 | class L2WindowTitleBar : public QWidget
10 | {
11 | public:
12 | L2WindowTitleBar(QWidget *parent = nullptr);
13 | ~L2WindowTitleBar();
14 |
15 | void SetMainWindow(QMainWindow *mainwindow);
16 |
17 | protected:
18 | void mousePressEvent(QMouseEvent *event) override;
19 | void mouseMoveEvent(QMouseEvent *event) override;
20 |
21 | private:
22 | QMainWindow *mMainWindow = nullptr;
23 | QPoint mClickPos;
24 | };
25 |
26 | #endif // L2MOVEABLEMENUBAR_H
27 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "l2mainwindow.h"
3 | #include "l2framelessmainwindow.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | #if 1
9 | L2FramelessMainWindow w;
10 | #else
11 | L2MainWindow w;
12 | #endif
13 | w.resize(400, 600);
14 | w.show();
15 |
16 | return a.exec();
17 | }
18 |
--------------------------------------------------------------------------------
/L2AutoHideWidget/resource.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | close.svg
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 l2m2
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # L2AutoHideWidget
2 |
3 | 
--------------------------------------------------------------------------------
/frameless_mainwindow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/l2m2/L2AutoHideWidget/3f2763a6ba800f3acbe9e988b12604a8fb45767b/frameless_mainwindow.gif
--------------------------------------------------------------------------------