Class: Ruber::Rake::ShortcutDelegate
- Inherits:
-
Qt::StyledItemDelegate
- Object
- Qt::StyledItemDelegate
- Ruber::Rake::ShortcutDelegate
- Defined in:
- plugins/rake/rake_widgets.rb
Overview
Delegate which allows to edit the entries using a KDE::KeySequenceWidget
Instance Method Summary (collapse)
-
- (Qt::Widget) createEditor(parent, opt, idx)
Override of
Qt::StyledItemDelegate#createEditor
which returns aKDE::KeySequenceWidget
. -
- (ShortcutDelegate) initialize(col, parent = nil)
constructor
A new instance of ShortcutDelegate.
-
- (nil) setEditorData(w, idx)
Override of
Qt::StyledItemDelegate#setEditorData
which fills the editor with the content of the model. -
- (nil) setModelData(w, model, idx)
Override of
Qt::StyledItemDelegate#setModelData
which inserts the contents of the shortcut widget in the model. -
- (nil) updateEditorGeometry(w, opt, idx)
Override of
Qt::StyledItemDelegate#updateEditorGeometry
.
Constructor Details
- (ShortcutDelegate) initialize(col, parent = nil)
A new instance of ShortcutDelegate
121 122 123 124 |
# File 'plugins/rake/rake_widgets.rb', line 121 def initialize col, parent = nil super parent @column = col end |
Instance Method Details
- (Qt::Widget) createEditor(parent, opt, idx)
Override of Qt::StyledItemDelegate#createEditor
which returns a
KDE::KeySequenceWidget
.
135 136 137 138 139 140 141 142 143 144 |
# File 'plugins/rake/rake_widgets.rb', line 135 def createEditor parent, opt, idx if idx.column != @column then super else w = KDE::KeySequenceWidget.new parent connect w, SIGNAL('stealShortcut(QKeySequence, KAction*)'), w, SLOT(:applyStealShortcut) collections = Ruber[:main_window].factory.clients.map{|cl| cl.action_collection} w.check_action_collections = collections w end end |
- (nil) setEditorData(w, idx)
Override of Qt::StyledItemDelegate#setEditorData
which fills the editor
with the content of the model.
154 155 156 157 158 159 |
# File 'plugins/rake/rake_widgets.rb', line 154 def setEditorData w, idx if idx.column != @column then super else w.key_sequence = Qt::KeySequence.new(idx.data.to_string) end nil end |
- (nil) setModelData(w, model, idx)
Override of Qt::StyledItemDelegate#setModelData
which inserts the contents
of the shortcut widget in the model.
170 171 172 173 174 175 |
# File 'plugins/rake/rake_widgets.rb', line 170 def setModelData w, model, idx if idx.column != @column then super else model.set_data idx, Qt::Variant.new(w.key_sequence.to_string), Qt::DisplayRole end nil end |
- (nil) updateEditorGeometry(w, opt, idx)
Override of Qt::StyledItemDelegate#updateEditorGeometry
geometry
186 187 188 189 190 191 192 193 194 195 |
# File 'plugins/rake/rake_widgets.rb', line 186 def updateEditorGeometry w, opt, idx if idx.column != @column then super else tl = opt.rect.top_left size = w.rect.size size.width += 50 w.geometry = Qt::Rect.new tl, size end nil end |