fix:bug#93818

This commit is contained in:
jzxc95 2021-11-29 10:20:53 +08:00
parent 86ef3190fd
commit 0fd4ca08df
4 changed files with 36 additions and 11 deletions

View File

@ -67,7 +67,7 @@ void Ipv4Page::initComponent() {
}
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));

View File

@ -142,7 +142,7 @@ void Ipv6Page::initComponent() {
}
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));

View File

@ -1,7 +1,9 @@
#include "netdetail.h"
#include "backend/kylinipv4arping.h"
#include "backend/kylinipv6arping.h"
#include "xatom/xatom-helper.h"
//#include "xatom/xatom-helper.h"
#include <QEvent>
#define WINDOW_WIDTH 520
#define WINDOW_HEIGHT 590
@ -48,15 +50,15 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
QDialog(parent)
{
//设置窗口无边框,阴影
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
MotifWmHints window_hints;
window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
window_hints.functions = MWM_FUNC_ALL;
window_hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
#else
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
// MotifWmHints window_hints;
// window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
// window_hints.functions = MWM_FUNC_ALL;
// window_hints.decorations = MWM_DECOR_BORDER;
// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
//#else
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
#endif
//#endif
// this->setProperty("useStyleWindowManager", false); //禁用拖动
// setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint );
// setAttribute(Qt::WA_TranslucentBackground);
@ -145,6 +147,12 @@ void NetDetail::initUI()
securityPage = new SecurityPage(this);
createNetPage = new CreatNetPage(this);
detailPage->installEventFilter(this);
ipv4Page->installEventFilter(this);
ipv6Page->installEventFilter(this);
securityPage->installEventFilter(this);
createNetPage->installEventFilter(this);
titleWidget = new QWidget(this);
centerWidget = new QWidget(this);
bottomWidget = new QWidget(this);
@ -917,3 +925,19 @@ bool NetDetail::checkWirelessSecurity(KySecuType secuType)
}
return true;
}
bool NetDetail::eventFilter(QObject *w, QEvent *event)
{
// 回车键触发确定按钮点击事件
if (event->type() == QEvent::KeyPress) {
QKeyEvent *mEvent = static_cast<QKeyEvent *>(event);
if (mEvent->key() == Qt::Key_Enter || mEvent->key() == Qt::Key_Return) {
if (confimBtn->isEnabled()) {
emit confimBtn->clicked();
}
return true;
}
}
return QDialog::eventFilter(w, event);
}

View File

@ -39,6 +39,7 @@ public:
protected:
void paintEvent(QPaintEvent *event);
void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *w, QEvent *event);
private:
void initUI();