aboutsummaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/tab_welcome.cpp8
-rw-r--r--src/widgets/tab_welcome.h9
2 files changed, 10 insertions, 7 deletions
diff --git a/src/widgets/tab_welcome.cpp b/src/widgets/tab_welcome.cpp
index 2c8dc56..49b4f2a 100644
--- a/src/widgets/tab_welcome.cpp
+++ b/src/widgets/tab_welcome.cpp
@@ -1,7 +1,8 @@
#include "tab_welcome.h"
+#include <QAction>
-TabWelcome::TabWelcome(QWidget* parent)
- : QWidget(parent), ui(new Ui::TabWelcome)
+TabWelcome::TabWelcome(RecentFiles::QMenuPtr recent_files_menu, QWidget* parent)
+ : recent_files_menu(recent_files_menu), QWidget(parent), ui(new Ui::TabWelcome)
{
ui->setupUi(this);
ui->horizontalLayout->setContentsMargins(0, 0, 0, 0);
@@ -20,5 +21,6 @@ void TabWelcome::on_openFileButton_clicked(bool checked) {
}
void TabWelcome::on_openRecentButton_clicked(bool checked) {
- emit show_recent_files();
+ if (recent_files_menu)
+ recent_files_menu->popup(ui->openRecentButton->mapToGlobal(QPoint(0,0)));
}
diff --git a/src/widgets/tab_welcome.h b/src/widgets/tab_welcome.h
index effc84f..497aae2 100644
--- a/src/widgets/tab_welcome.h
+++ b/src/widgets/tab_welcome.h
@@ -1,6 +1,7 @@
#pragma once
#include <QWidget>
#include "./ui_tab_welcome.h"
+#include "../recent_files.h"
QT_BEGIN_NAMESPACE
namespace Ui { class TabWelcome; }
@@ -10,15 +11,14 @@ class TabWelcome : public QWidget {
Q_OBJECT
public:
- TabWelcome(QWidget* parent = nullptr);
+ TabWelcome(RecentFiles::QMenuPtr recent_files_menu = nullptr, QWidget* parent = nullptr);
~TabWelcome();
signals:
// Show Open file dialog
void show_file_open_dialog();
-
- // Show recents dropdown
- void show_recent_files();
+ // Open this file path
+ void open_file(const QString& path);
private slots:
void on_openFileButton_clicked(bool checked);
@@ -26,4 +26,5 @@ private slots:
private:
Ui::TabWelcome* ui;
+ RecentFiles::QMenuPtr recent_files_menu;
};