qt - Adding slots to automatically created menu items -
I have an existing menu called Saved, and I want to add two menus in it, save the new and save the edit. I looked up for a suitable function and found it, but I need help implemening this How I Can Do It with the same parameter you will use in that If the menu was created in the designer, you can connect the same action at the same time: Or use the signal / slot editor to add tasks directly from within the designer. QMenu * Menu = New QMenu (this); Menu-> AddAction ("save new"); // zero saveNew () Menu- & gt; AddAction ("Save Editing"); // zero saveEdits () ui.saveButton- & gt; SetMenu (menu);
QAction * QMenu :: addAction (constant QString & Amp; Text, Constants QObject * Receiver, Constants 4 * Member, Constants QKeySequence & Shortcut = 0)
menu-> AddAction ("Save new", this, slot (saveNew ());
connect call:
QAction * saveAction = menu-> AddAction "save new"); Connect (Save Action, Signal (Trigger), This, Slot (SaveNet));
connect (ui.saveAction, signal (triggers) ()), This, slot (senetate ()));
Comments
Post a Comment