136 lines
4.0 KiB
Diff
136 lines
4.0 KiB
Diff
From e7bc75d3a9334f56ff0906ad98cbff148b0a5c57 Mon Sep 17 00:00:00 2001
|
|
From: huayadong <huayadong@kylinos.cn>
|
|
Date: Fri, 10 Dec 2021 10:37:51 +0800
|
|
Subject: [PATCH] right click menu in Chinese editing network settings
|
|
|
|
---
|
|
src/confform.cpp | 10 +++++++++-
|
|
src/confform.h | 3 ++-
|
|
src/confform.ui | 3 +++
|
|
src/mainwindow.cpp | 3 ++-
|
|
src/oneconnform.cpp | 2 +-
|
|
src/onelancform.cpp | 2 +-
|
|
6 files changed, 18 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/confform.cpp b/src/confform.cpp
|
|
index f0c04ce..d62cbb4 100755
|
|
--- a/src/confform.cpp
|
|
+++ b/src/confform.cpp
|
|
@@ -30,7 +30,7 @@
|
|
extern QString llname, lwname;
|
|
|
|
ConfForm::ConfForm(QWidget *parent) :
|
|
- QWidget(parent),
|
|
+ QDialog(parent),
|
|
ui(new Ui::ConfForm)
|
|
{
|
|
ui->setupUi(this);
|
|
@@ -92,6 +92,12 @@ ConfForm::ConfForm(QWidget *parent) :
|
|
// ui->btnCancel->setStyleSheet(btnOffQss);
|
|
// ui->btnOk->setStyleSheet(btnOnQss);
|
|
// ui->btnCreate->setStyleSheet(btnOnQss);
|
|
+ ui->leAddr->setContextMenuPolicy(Qt::NoContextMenu);
|
|
+ ui->leName->setContextMenuPolicy(Qt::NoContextMenu);
|
|
+ ui->leDns->setContextMenuPolicy(Qt::NoContextMenu);
|
|
+ ui->leDns2->setContextMenuPolicy(Qt::NoContextMenu);
|
|
+ ui->leGateway->setContextMenuPolicy(Qt::NoContextMenu);
|
|
+
|
|
ui->lineUp->setStyleSheet(lineQss);
|
|
ui->lineDown->setStyleSheet(lineQss);
|
|
ui->lineUp->hide();
|
|
@@ -148,6 +154,7 @@ void ConfForm::mousePressEvent(QMouseEvent *event)
|
|
this->dragPos = event->globalPos();
|
|
event->accept();
|
|
}
|
|
+ return QDialog::mousePressEvent(event);
|
|
}
|
|
void ConfForm::mouseReleaseEvent(QMouseEvent *event)
|
|
{
|
|
@@ -159,6 +166,7 @@ void ConfForm::mouseMoveEvent(QMouseEvent *event)
|
|
this->move(this->winPos - (this->dragPos - event->globalPos()));
|
|
event->accept();
|
|
}
|
|
+ return QDialog::mouseMoveEvent(event);
|
|
}
|
|
|
|
//网络配置参数设置界面的显示内容
|
|
diff --git a/src/confform.h b/src/confform.h
|
|
index e29cdd2..b40d2c2 100755
|
|
--- a/src/confform.h
|
|
+++ b/src/confform.h
|
|
@@ -25,13 +25,14 @@
|
|
#include <QPoint>
|
|
#include <QPainter>
|
|
#include <QPainterPath>
|
|
+#include <QDialog>
|
|
#include <QListView>
|
|
|
|
namespace Ui {
|
|
class ConfForm;
|
|
}
|
|
|
|
-class ConfForm : public QWidget
|
|
+class ConfForm : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
diff --git a/src/confform.ui b/src/confform.ui
|
|
index 3b117a5..a312a94 100755
|
|
--- a/src/confform.ui
|
|
+++ b/src/confform.ui
|
|
@@ -13,6 +13,9 @@
|
|
<property name="windowTitle">
|
|
<string/>
|
|
</property>
|
|
+ <property name="toolTip">
|
|
+ <string/>
|
|
+ </property>
|
|
<widget class="QWidget" name="centralWidget" native="true">
|
|
<property name="geometry">
|
|
<rect>
|
|
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
|
|
index 6461855..7d9bfdf 100755
|
|
--- a/src/mainwindow.cpp
|
|
+++ b/src/mainwindow.cpp
|
|
@@ -1871,9 +1871,10 @@ void MainWindow::onBtnCreateNetClicked()
|
|
|
|
QApplication::setQuitOnLastWindowClosed(false);
|
|
ConfForm *m_cf = new ConfForm();
|
|
+ m_cf->setAttribute(Qt::WA_DeleteOnClose);
|
|
m_cf->cbTypeChanged(3);
|
|
m_cf->move(primaryGeometry.width() / 2 - m_cf->width() / 2, primaryGeometry.height() / 2 - m_cf->height() / 2);
|
|
- m_cf->show();
|
|
+ m_cf->exec();
|
|
}
|
|
|
|
|
|
diff --git a/src/oneconnform.cpp b/src/oneconnform.cpp
|
|
index aa6a97d..fde19c4 100755
|
|
--- a/src/oneconnform.cpp
|
|
+++ b/src/oneconnform.cpp
|
|
@@ -653,7 +653,7 @@ void OneConnForm::on_btnInfo_clicked()
|
|
cf->setProp(ui->lbName->text(), v4method, addr, mask, gateway, dns, this->isActive);
|
|
|
|
cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2);
|
|
- cf->show();
|
|
+ cf->exec();
|
|
cf->raise();
|
|
|
|
bt->deleteLater();
|
|
diff --git a/src/onelancform.cpp b/src/onelancform.cpp
|
|
index 5dd6634..3d03baf 100755
|
|
--- a/src/onelancform.cpp
|
|
+++ b/src/onelancform.cpp
|
|
@@ -373,7 +373,7 @@ void OneLancForm::on_btnInfo_clicked()
|
|
connect(cf, SIGNAL(requestRefreshLanList(int)), mw, SLOT(onBtnNetListClicked(int)));
|
|
|
|
cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2);
|
|
- cf->show();
|
|
+ cf->exec();
|
|
cf->raise();
|
|
cf->activateWindow();
|
|
}
|
|
--
|
|
2.30.0
|
|
|