From 77f1186af8dd8aab7ef46e6ce782aa3f7278379c Mon Sep 17 00:00:00 2001 From: w-mj Date: Sun, 24 Dec 2017 10:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=8F=E4=B8=BB=E7=AA=97=E5=8F=A3=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mainwindow.cpp | 9 +++++++++ mainwindow.h | 1 + 2 files changed, 10 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index c17866e..184a0ba 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -18,6 +18,7 @@ MainWindow::MainWindow(QWidget *parent) : Monitor *monitor = new Monitor(this); resize(monitor->size()); + installEventFilter(this); } MainWindow::~MainWindow() @@ -52,3 +53,11 @@ void MainWindow::showListWindow(bool enable) } else list->hide(); } + +bool MainWindow::eventFilter(QObject *obj, QEvent *event) { + if (event->type() == QEvent::Move) { + logWindow->setGeometry(x()+width() + 15, y() + 35, 400, 450); + list->setGeometry(x()+width() + 15, y() + width() / 2, 400, 450); + } + return QWidget::eventFilter(obj, event); + } diff --git a/mainwindow.h b/mainwindow.h index 2963bce..2f436d3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -21,6 +21,7 @@ public: void open(void); void showLogWindow(bool enable); void showListWindow(bool enable); + bool eventFilter(QObject *obj, QEvent *event); ~MainWindow(); private: