Class: KDE::ActionCollection
- Inherits:
-
Object
- Object
- KDE::ActionCollection
- Defined in:
- lib/mylibs.rb
Instance Method Summary collapse
-
#addNew(name, parent = self.parent, options = {}) ⇒ Object
: KDE::Action.
Instance Method Details
#addNew(name, parent = self.parent, options = {}) ⇒ Object
Returns : KDE::Action.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/mylibs.rb', line 196 def addNew(name, parent=self.parent, = {}) text = [:text] || name icon = [:icon] if icon then action = KDE::Action.new(KDE::Icon.new(icon), text, parent) else action = KDE::Action.new(text, parent) end shortCut = [:shortCut] if shortCut then action.setShortcut(KDE::Shortcut.new(shortCut)) end self.addAction(action.text, action) slot = [:triggered] if slot then if slot.kind_of? Array then self.connect(action, SIGNAL(:triggered), slot[0], \ SLOT(slot[1])) else self.connect(action, SIGNAL(:triggered), parent, \ SLOT(slot)) end end action end |