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. QMenu * Menu = New QMenu (this); Menu-> AddAction ("save new"); // zero saveNew () Menu- & gt; AddAction ("Save Editing"); // zero saveEdits () ui.saveButton- & gt; SetMenu (menu);

I looked up for a suitable function and found it, but I need help implemening this

  QAction * QMenu :: addAction (constant QString & Amp; Text, Constants QObject * Receiver, Constants 4 * Member, Constants QKeySequence & Shortcut = 0)   

How I Can Do It

  menu-> AddAction ("Save new", this, slot (saveNew ());   

with the same parameter you will use in that connect call:

  QAction * saveAction = menu-> AddAction "save new"); Connect (Save Action, Signal (Trigger), This, Slot (SaveNet));   

If the menu was created in the designer, you can connect the same action at the same time:

  connect (ui.saveAction, signal (triggers) ()), This, slot (senetate ()));   

Or use the signal / slot editor to add tasks directly from within the designer.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -