|
@@ -1,6 +1,9 @@
|
|
|
#include "mainwindow.h"
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
+#include <QMouseEvent>
|
|
|
+#include <QDesktopWidget>
|
|
|
+
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
QMainWindow(parent),
|
|
|
ui(new Ui::MainWindow)
|
|
@@ -10,6 +13,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
ui->lineEdit_2->setValidator(new QIntValidator(ui->lineEdit_2));
|
|
|
ui->lineEdit_3->setValidator(new QIntValidator(ui->lineEdit_3));
|
|
|
|
|
|
+ this->setFixedSize(900, 600);
|
|
|
+ QDesktopWidget *deskdop = QApplication::desktop();
|
|
|
+ QRect rect = deskdop->screenGeometry();
|
|
|
+ move(rect.width() / 4, rect.height() / 4);
|
|
|
+// setWindowIcon(QIcon(":/background/360logo.ico"));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
@@ -17,6 +26,29 @@ MainWindow::~MainWindow()
|
|
|
delete ui;
|
|
|
}
|
|
|
|
|
|
+void MainWindow::mousePressEvent(QMouseEvent *event)
|
|
|
+{
|
|
|
+ if (event->button() == Qt::LeftButton){
|
|
|
+ windowPos = this->pos();
|
|
|
+ mousePos = event->globalPos();
|
|
|
+ isMousePress = true;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::mouseReleaseEvent(QMouseEvent *event)
|
|
|
+{
|
|
|
+ if (event->button() == Qt::LeftButton)
|
|
|
+ isMousePress = false;
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::mouseMoveEvent(QMouseEvent *event)
|
|
|
+{
|
|
|
+ if (isMousePress == true){
|
|
|
+ move(windowPos + (event->globalPos() - mousePos));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
|
{
|
|
|
ServiceCarStatus.wheelangle = ui->lineEdit->text().toInt();
|