From 8691fe4f1cae523bc2fdd64d3e90326f92fcb9d6 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 31 Mar 2018 10:51:56 +0200 Subject: Add context menu to FSWidget Also create a helper function to create separator actions. --- fswidget.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fswidget.cpp') diff --git a/fswidget.cpp b/fswidget.cpp index 1932c10..fb78a1f 100644 --- a/fswidget.cpp +++ b/fswidget.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -103,6 +104,8 @@ void FSWidget::setupWidget(){ mProxy->setSourceModel(mModel); mFileView->setModel(mProxy); + addActions(QList() << backA << forwardA << Helper::createSeparator(this) << refreshA); + QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topWL); mainLayout->addWidget(mFileView); @@ -115,6 +118,12 @@ FSWidget::~FSWidget(){ writeSettings(); } +void FSWidget::contextMenuEvent(QContextMenuEvent *e){ + QMenu contextMenu(this); + contextMenu.addActions(actions()); + contextMenu.exec(e->globalPos()); +} + void FSWidget::readSettings(){ QSettings s; QStringList dirs = s.value("fs/dirs").toStringList(); -- cgit v1.2.3-70-g09d2