Mercurial > hg > octave-nkf
changeset 16614:49653ed9561b
Use menu triggered signal instead of action triggered signal to rid cast.
* file-editor.cc (file_editor::request_mru_open_file): Add QAction pointer as
function argument. Remove sender() cast.
(file_editor::construct): Connect request_mru_open_file slot to menu trigger
signal instead of action trigger signals.
* file-editor.h (file_editor : public file_editor_interface): Add QAction
pointer as input to request_mru_open_file slot.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Sat, 04 May 2013 22:51:43 -0500 |
parents | 99a57611d58a |
children | cb09eecbd84e |
files | libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h |
diffstat | 2 files changed, 4 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -319,9 +319,8 @@ // open a file from the mru list void -file_editor::request_mru_open_file (void) +file_editor::request_mru_open_file (QAction *action) { - QAction *action = qobject_cast<QAction *> (sender ()); if (action) { request_open_file (action->data ().toString ()); @@ -981,12 +980,8 @@ connect (goto_line_action, SIGNAL (triggered ()), this, SLOT (request_goto_line ())); - // The actions of the mru file menu - for (int i = 0; i < MaxMRUFiles; ++i) - { - connect (_mru_file_actions[i], SIGNAL (triggered ()), - this, SLOT (request_mru_open_file ())); - } + connect (_mru_file_menu, SIGNAL (triggered (QAction *)), + this, SLOT (request_mru_open_file (QAction *))); mru_menu_update ();
--- a/libgui/src/m-editor/file-editor.h +++ b/libgui/src/m-editor/file-editor.h @@ -105,7 +105,7 @@ void request_new_script (const QString& commands); void request_new_function (const QString& commands); void request_open_file (void); - void request_mru_open_file (void); + void request_mru_open_file (QAction *action); void request_print_file (void); void request_undo (void);