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 + 车牌号