changeset 27637:d16336646e18

return pointer to file_editor_tab from file_editor::find_tab_widget * file-editor.h, file-editor.cc (file_editor::find_tab_widget): Return pointer to file_editor_tab instead of QWidget. Change all uses.
author John W. Eaton <jwe@octave.org>
date Tue, 05 Nov 2019 00:25:23 -0500
parents dc319e1ea4a3
children 95534a0ad14c
files libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Tue Nov 05 00:14:14 2019 -0500
+++ b/libgui/src/m-editor/file-editor.cc	Tue Nov 05 00:25:23 2019 -0500
@@ -922,7 +922,7 @@
                                          bool remove_on_success)
   {
     // Check whether this file is already open in the editor.
-    QWidget *tab = find_tab_widget (saveFileName);
+    file_editor_tab *tab = find_tab_widget (saveFileName);
 
     if (tab)
       {
@@ -990,7 +990,7 @@
     if (! file.isEmpty ())
       {
         // Check whether this file is already open in the editor.
-        QWidget *tab = find_tab_widget (file);
+        file_editor_tab *tab = find_tab_widget (file);
 
         if (tab)
           {
@@ -1054,8 +1054,7 @@
         else
           {
             // It is a single file. Is it open?
-            file_editor_tab *editor_tab
-              = static_cast<file_editor_tab *> (find_tab_widget (old_names.at (i)));
+            file_editor_tab *editor_tab = find_tab_widget (old_names.at (i));
 
             if (editor_tab)
               {
@@ -1409,7 +1408,7 @@
     else
       {
         // Check whether this file is already open in the editor.
-        QWidget *tab = find_tab_widget (openFileName);
+        file_editor_tab *tab = find_tab_widget (openFileName);
 
         if (tab)
           {
@@ -1447,7 +1446,7 @@
             tab = find_tab_widget ("");
             if (tab)
               {
-                fileEditorTab = static_cast<file_editor_tab *>(tab);
+                fileEditorTab = tab;
                 if (fileEditorTab->qsci_edit_area ()->isModified ())
                   fileEditorTab = nullptr;
                 else
@@ -2601,7 +2600,7 @@
   }
 
   // Check whether this file is already open in the editor.
-  QWidget * file_editor::find_tab_widget (const QString& file)
+  file_editor_tab * file_editor::find_tab_widget (const QString& file)
   {
     std::string std_file = file.toStdString ();
 
--- a/libgui/src/m-editor/file-editor.h	Tue Nov 05 00:14:14 2019 -0500
+++ b/libgui/src/m-editor/file-editor.h	Tue Nov 05 00:25:23 2019 -0500
@@ -339,7 +339,7 @@
 
     bool editor_tab_has_focus (void);
 
-    QWidget * find_tab_widget (const QString& openFileName);
+    file_editor_tab * find_tab_widget (const QString& openFileName);
     QAction * add_action (QMenu *menu, const QString& text,
                           const char *member, QWidget *receiver = nullptr);
     QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text,