自动打开两个窗口

This commit is contained in:
w-mj committed 2017-12-24 16:38:43 +08:00
1 parent 9ec3bb2b4b
commit b56efd21b9
4 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -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);
}
}
+12
View File
@@ -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;
+1
View File
@@ -20,6 +20,7 @@ class Monitor : public QWidget
public:
explicit Monitor(MainWindow *parent = 0);
void showEvent(QShowEvent *event);
~Monitor();
private:
+3
View File
@@ -202,6 +202,9 @@
<property name="text">
<string/>
</property>
<property name="maxLength">
<number>6</number>
</property>
<property name="placeholderText">
<string>车牌号</string>
</property>