Mercurial > octave-libtiff
changeset 23177:0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
* file-editor-tab.h: new signal set_focus_editor_signal
* file-editor-tab.cc (file_has_changed): emit new signal for showing the
editor if hidden and making the tab of the changed file the current one;
set the focus to this tab
* file-editor.h: new slot set_focus ()
* file-editor.cc (set_focus): new slot for getting the focus and making the
given edtior tab the current one;
(add_file_editor_tab): connect the new signal with the related new slot
author | Torsten <mttl@mailbox.org> |
---|---|
date | Wed, 08 Feb 2017 07:54:28 +0100 |
parents | 5f7c675b3954 |
children | 751c389404b9 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h |
diffstat | 4 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Tue Feb 07 20:16:28 2017 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Wed Feb 08 07:54:28 2017 +0100 @@ -2188,6 +2188,11 @@ else { + // give editor and this tab the focus, + // possibly making the editor visible if it is hidden + emit set_focus_editor_signal (this); + _edit_area->setFocus (); + // Create a WindowModal message that blocks the edit area // by making _edit_area parent. QMessageBox* msgBox @@ -2207,6 +2212,11 @@ } else { + // give editor and this tab the focus, + // possibly making the editor visible if it is hidden + emit set_focus_editor_signal (this); + _edit_area->setFocus (); + QString modified = ""; if (_edit_area->isModified ()) modified = tr ("\n\nWarning: The contents in the editor is modified!");
--- a/libgui/src/m-editor/file-editor-tab.h Tue Feb 07 20:16:28 2017 +0100 +++ b/libgui/src/m-editor/file-editor-tab.h Wed Feb 08 07:54:28 2017 +0100 @@ -151,6 +151,7 @@ void file_name_changed (const QString& fileName, const QString& toolTip); void editor_state_changed (bool copy_available, bool is_octave_file); + void set_focus_editor_signal (QWidget *); void tab_remove_request (); void add_filename_to_list (const QString&, const QString&, QWidget *); void mru_add_file (const QString& file_name, const QString& encoding);
--- a/libgui/src/m-editor/file-editor.cc Tue Feb 07 20:16:28 2017 +0100 +++ b/libgui/src/m-editor/file-editor.cc Wed Feb 08 07:54:28 2017 +0100 @@ -162,6 +162,16 @@ } void +file_editor::set_focus (QWidget *fet) +{ + octave_dock_widget::focus (); + + // set focus to desired tab + if (fet) + _tab_widget->setCurrentWidget (fet); +} + +void file_editor::update_octave_directory (const QString& dir) { ced = dir; @@ -2013,6 +2023,9 @@ const QString&, const QString&, int))); + connect (f, SIGNAL (set_focus_editor_signal (QWidget*)), + this, SLOT (set_focus (QWidget*))); + // Signals from the file_editor non-trivial operations connect (this, SIGNAL (fetab_settings_changed (const QSettings *)), f, SLOT (settings_changed (const QSettings *)));