From b2be082e3de143fe8a18219a768cf86716559c92 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Sun, 4 Jul 2021 20:56:19 +0200
Subject: [PATCH] UI: Add the method to handle the double-click on tab to open
 its properties

---
 src/UI/MainWindow.cc | 9 +++++++++
 src/UI/MainWindow.hh | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/src/UI/MainWindow.cc b/src/UI/MainWindow.cc
index 212abaf9..5e870b9c 100644
--- a/src/UI/MainWindow.cc
+++ b/src/UI/MainWindow.cc
@@ -88,6 +88,7 @@ MainWindow::MainWindow(QWidget *parent) noexcept
     documents->setUsesScrollButtons(true);
     documents->setDocumentMode(true);
     connect(documents, &QTabWidget::tabCloseRequested, this, &MainWindow::closeDocument);
+    connect(documents, &QTabWidget::tabBarDoubleClicked, this, &MainWindow::openProperties);
     setCentralWidget(documents);
 
     /* Enable/disable actions depending on the context */
@@ -121,6 +122,14 @@ MainWindow::MainWindow(QWidget *parent) noexcept
     statusBar()->showMessage("QSimulate has started");
 }
 
+void
+MainWindow::openProperties(int index) noexcept
+{
+    if (index < 0)
+        return;
+    qDebug().nospace() << "Tab n°" << index << " was double clicked";
+}
+
 std::weak_ptr<VivyDocument>
 MainWindow::getCurrentDocument() const
 {
diff --git a/src/UI/MainWindow.hh b/src/UI/MainWindow.hh
index fc3e60ea..f5d18642 100644
--- a/src/UI/MainWindow.hh
+++ b/src/UI/MainWindow.hh
@@ -35,6 +35,8 @@ private slots:
     void openDocument() noexcept;
     void closeDocument(int index) noexcept;
 
+    void openProperties(int index) noexcept;
+
     void loadSubDocumentAss() noexcept;
     void loadSubDocumentVideo() noexcept;
     void loadSubDocumentAudio() noexcept;
-- 
GitLab