Module: ListLike

Included in:
KDE::ComboBox, Qt::ListWidget
Defined in:
lib/rui/toolkits/qtbase/qt.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



414
415
416
# File 'lib/rui/toolkits/qtbase/qt.rb', line 414

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#reset_from_a(array) ⇒ Object

Populate the list with values from an array. See also from_a.



402
403
404
405
406
407
408
409
410
411
412
# File 'lib/rui/toolkits/qtbase/qt.rb', line 402

def reset_from_a(array)
  clear
  array.each do |values|
    text, data = if values.is_a?(String)
      [values, values]
    else
      values
    end
    create_item(text, data)
  end
end

#select_item(&blk) ⇒ Object

Select the item for which the given block evaluates to true.



388
389
390
391
392
393
394
395
396
# File 'lib/rui/toolkits/qtbase/qt.rb', line 388

def select_item(&blk)
  (0...count).each do |i|
    if blk[item(i).get]
      self.current_index = i
      break i
    end
  end
  nil
end