comparison libgui/src/m-editor/file-editor.cc @ 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 999400bebe5e
children cb09eecbd84e
comparison
equal deleted inserted replaced
16613:99a57611d58a 16614:49653ed9561b
317 } 317 }
318 } 318 }
319 319
320 // open a file from the mru list 320 // open a file from the mru list
321 void 321 void
322 file_editor::request_mru_open_file (void) 322 file_editor::request_mru_open_file (QAction *action)
323 { 323 {
324 QAction *action = qobject_cast<QAction *> (sender ());
325 if (action) 324 if (action)
326 { 325 {
327 request_open_file (action->data ().toString ()); 326 request_open_file (action->data ().toString ());
328 } 327 }
329 } 328 }
979 this, SLOT (request_find ())); 978 this, SLOT (request_find ()));
980 979
981 connect (goto_line_action, SIGNAL (triggered ()), 980 connect (goto_line_action, SIGNAL (triggered ()),
982 this, SLOT (request_goto_line ())); 981 this, SLOT (request_goto_line ()));
983 982
984 // The actions of the mru file menu 983 connect (_mru_file_menu, SIGNAL (triggered (QAction *)),
985 for (int i = 0; i < MaxMRUFiles; ++i) 984 this, SLOT (request_mru_open_file (QAction *)));
986 {
987 connect (_mru_file_actions[i], SIGNAL (triggered ()),
988 this, SLOT (request_mru_open_file ()));
989 }
990 985
991 mru_menu_update (); 986 mru_menu_update ();
992 987
993 connect (_tab_widget, SIGNAL (tabCloseRequested (int)), 988 connect (_tab_widget, SIGNAL (tabCloseRequested (int)),
994 this, SLOT (handle_tab_close_request (int))); 989 this, SLOT (handle_tab_close_request (int)));