diff --git a/src/frontend/netdetails/ipv4page.cpp b/src/frontend/netdetails/ipv4page.cpp index abb220a8..d88e31dc 100644 --- a/src/frontend/netdetails/ipv4page.cpp +++ b/src/frontend/netdetails/ipv4page.cpp @@ -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())); diff --git a/src/frontend/netdetails/ipv6page.cpp b/src/frontend/netdetails/ipv6page.cpp index f281125d..6d154728 100644 --- a/src/frontend/netdetails/ipv6page.cpp +++ b/src/frontend/netdetails/ipv6page.cpp @@ -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())); diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 7e5588cd..9d95cb72 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -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 #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(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); +} diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 7e0b59e7..04300034 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -39,6 +39,7 @@ public: protected: void paintEvent(QPaintEvent *event); void closeEvent(QCloseEvent *event); + bool eventFilter(QObject *w, QEvent *event); private: void initUI();