From 5bbd3229ef341e592c183ad2989b95f1de4c4f6c Mon Sep 17 00:00:00 2001 From: touwoyimuli Date: Sat, 21 Sep 2019 16:36:20 +0800 Subject: [PATCH] feat: QListWidget and QToolButton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 列表控件QListWidget和工具按钮QToolButton的介绍和使用 --- QtQlistWidgetEx/ExQListWidget.cpp | 6 ++++++ QtQlistWidgetEx/ExQListWidget.h | 1 + QtQlistWidgetEx/QtQlistWidgetEx.pro | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/QtQlistWidgetEx/ExQListWidget.cpp b/QtQlistWidgetEx/ExQListWidget.cpp index 7bfaa8f..66ac4f7 100644 --- a/QtQlistWidgetEx/ExQListWidget.cpp +++ b/QtQlistWidgetEx/ExQListWidget.cpp @@ -214,3 +214,9 @@ void ExQListWidget::on_listWidget_customContextMenuRequested(const QPoint &pos) menu->exec(QCursor::pos()); //在鼠标光标位置显示右键快捷菜单 delete menu; //手工创建的指针必须手工删除 } + +//退出 +void ExQListWidget::on_actExit_triggered() +{ + this->close(); +} diff --git a/QtQlistWidgetEx/ExQListWidget.h b/QtQlistWidgetEx/ExQListWidget.h index 7e9a7ab..83825de 100644 --- a/QtQlistWidgetEx/ExQListWidget.h +++ b/QtQlistWidgetEx/ExQListWidget.h @@ -28,6 +28,7 @@ private slots: void on_actSelInvs_triggered(); //反选已筛选的item void on_listWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); //显示当前item的变动 void on_listWidget_customContextMenuRequested(const QPoint &pos); //ListWidget弹出鼠标右键菜单 + void on_actExit_triggered(); //退出软件 private: void setActionForToolBtn(); //创建cation和toolButton的关联 diff --git a/QtQlistWidgetEx/QtQlistWidgetEx.pro b/QtQlistWidgetEx/QtQlistWidgetEx.pro index 72fe7ea..a72dbd6 100644 --- a/QtQlistWidgetEx/QtQlistWidgetEx.pro +++ b/QtQlistWidgetEx/QtQlistWidgetEx.pro @@ -34,7 +34,7 @@ HEADERS += \ FORMS += \ ExQListWidget.ui -#RC_ICONS += qt.ico +RC_ICONS += qt.ico # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin