diff --git a/chfsgui/chfsgui.pro b/chfsgui/chfsgui.pro index 5d53213..d25888c 100644 --- a/chfsgui/chfsgui.pro +++ b/chfsgui/chfsgui.pro @@ -16,7 +16,7 @@ QTPLUGIN += qsvg PRECOMPILED_HEADER = preCompile.h CONFIG += c++11 -DEFINES += "GUIVER=0" +DEFINES += "GUIVER=1" SOURCES += main.cpp\ mainwindow.cpp \ diff --git a/chfsgui/monitorwgt.cpp b/chfsgui/monitorwgt.cpp index c5ffca2..5a82167 100644 --- a/chfsgui/monitorwgt.cpp +++ b/chfsgui/monitorwgt.cpp @@ -3,6 +3,7 @@ #include #include #include +#include LogWidget::LogWidget(QWidget *parent) : QWidget(parent) { @@ -12,7 +13,7 @@ LogWidget::LogWidget(QWidget *parent) : QWidget(parent) logBtn->setToolTip("点击打开操作日志目录"); connect(logBtn,&QLabel::linkActivated,[=](){ extern QString logPathRoot; - QDesktopServices::openUrl(QUrl(logPathRoot)); + QDesktopServices::openUrl(QUrl::fromLocalFile(logPathRoot)); }); QVBoxLayout* mainLayout = new QVBoxLayout(this); @@ -20,6 +21,21 @@ LogWidget::LogWidget(QWidget *parent) : QWidget(parent) mainLayout->setSpacing(2); mainLayout->addWidget( logBtn ); mainLayout->addWidget( logList ); + + createActions(); +} + +void LogWidget::contextMenuEvent(QContextMenuEvent *event) +{ + menu->exec(event->globalPos()); +} + +void LogWidget::createActions() +{ + menu = new QMenu; + menu->addAction(tr("清空显示"),this,[=](){ + logList->clear(); + }); } void LogWidget::paintEvent(QPaintEvent *) diff --git a/chfsgui/monitorwgt.h b/chfsgui/monitorwgt.h index b807bbe..aa689a4 100644 --- a/chfsgui/monitorwgt.h +++ b/chfsgui/monitorwgt.h @@ -48,14 +48,18 @@ public slots: }; - +class QMenu; class LogWidget : public QWidget { Q_OBJECT public: explicit LogWidget(QWidget *parent = 0); void paintEvent(QPaintEvent *) override; + void contextMenuEvent(QContextMenuEvent *event) override; QListWidget* logList; +private: + void createActions(); + QMenu* menu; signals: public slots: diff --git a/chfsgui/uicomponents/configwgt/cfgrules.cpp b/chfsgui/uicomponents/configwgt/cfgrules.cpp index f270007..de96f09 100644 --- a/chfsgui/uicomponents/configwgt/cfgrules.cpp +++ b/chfsgui/uicomponents/configwgt/cfgrules.cpp @@ -15,7 +15,6 @@ CfgRules::CfgRules(QWidget *parent) : CfgBase(parent) { createContents(); - initAccList(); // // connections @@ -52,6 +51,10 @@ CfgRules::CfgRules(QWidget *parent) : CfgBase(parent) } } }); + + // 初始化 + + initAccList(); } void CfgRules::initAccList() diff --git a/chfsgui/uicomponents/configwgt/cfgsharedpathwgt.cpp b/chfsgui/uicomponents/configwgt/cfgsharedpathwgt.cpp index 36fec0a..25574b1 100644 --- a/chfsgui/uicomponents/configwgt/cfgsharedpathwgt.cpp +++ b/chfsgui/uicomponents/configwgt/cfgsharedpathwgt.cpp @@ -67,6 +67,6 @@ void CfgSharedpathWgt::onPathChanging() g_settings.setValue(PARAM_PATH, dir); } }else{ - QDesktopServices::openUrl(QUrl(_editPath->text())); + QDesktopServices::openUrl(QUrl::fromLocalFile(_editPath->text())); } }