From b56efd21b960142e884fcdd925db49c25a10165c Mon Sep 17 00:00:00 2001 From: w-mj Date: Sun, 24 Dec 2017 16:38:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mainwindow.cpp | 2 +- monitor.cpp | 12 ++++++++++++ monitor.h | 1 + monitor.ui | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 8c3e2cb..93d574b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -62,4 +62,4 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) { list->setGeometry(x()+width() + 15, y() + width() / 2, 400, 450); } return QWidget::eventFilter(obj, event); - } +} diff --git a/monitor.cpp b/monitor.cpp index ba1a5f3..9d2ed4f 100644 --- a/monitor.cpp +++ b/monitor.cpp @@ -45,6 +45,18 @@ Monitor::Monitor(MainWindow *parent) : CarList::getInstance()->setAdapter(adapter); } +void Monitor::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + QTimer *timer = new QTimer(this); + timer->setSingleShot(true); + connect(timer, &QTimer::timeout, [this]() { + emit this->ui->showList->toggle(); + emit this->ui->showLog->toggle(); + }); + timer->start(100); // 延时100ms,等待窗口创建完毕后执行,哈哈哈哈哈 +} + Monitor::~Monitor() { delete ui; diff --git a/monitor.h b/monitor.h index 05e00f8..c014546 100644 --- a/monitor.h +++ b/monitor.h @@ -20,6 +20,7 @@ class Monitor : public QWidget public: explicit Monitor(MainWindow *parent = 0); + void showEvent(QShowEvent *event); ~Monitor(); private: diff --git a/monitor.ui b/monitor.ui index 3a86d8d..27102f8 100644 --- a/monitor.ui +++ b/monitor.ui @@ -202,6 +202,9 @@ + + 6 + 车牌号