Class: Qt::StandardItem

Inherits:
Object show all
Includes:
QtEnumerable
Defined in:
lib/ruber/qt_sugar.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) checked=(value)

Sets the check state to Qt::Unchecked if value is false or nil and to Qt::Checked otherwise



566
567
568
# File 'lib/ruber/qt_sugar.rb', line 566

def checked= value
  self.check_state = (value ? Qt::Checked : Qt::Unchecked)
end

- (Boolean) checked?

Returns true if the check state is Qt::Checked or Qt::PartiallyChecked

Returns:

  • (Boolean)


553
554
555
# File 'lib/ruber/qt_sugar.rb', line 553

def checked?
  check_state != Qt::Unchecked
end

- (Object) each

Iterates on all child items. If no block is given, returns an Enumerator

Note: this method iterates only on those items which are directly child of self; it’s not recursive.


525
526
527
528
529
530
531
532
533
534
535
# File 'lib/ruber/qt_sugar.rb', line 525

def each
  if block_given?
    rowCount.times do |i|
      columnCount.times do |j|
        c = child i, j
        yield c if c
      end
    end
  else self.to_enum
  end
end

- (Object) each_row

Passes an array containing the items in each of the children rows. Returns an Enumerator if called without a block



541
542
543
544
545
546
547
548
549
550
# File 'lib/ruber/qt_sugar.rb', line 541

def each_row
  if block_given?
    rowCount.times do |i|
      a = []
      columnCount.times{|j| a << child( i,j)}
      yield a
    end
  else to_enum
  end
end

- (Boolean) fully_checked?

Returns true if the check_state is Qt::Checked and false otherwise

Returns:

  • (Boolean)


558
559
560
# File 'lib/ruber/qt_sugar.rb', line 558

def fully_checked?
  self.check_state == Qt::Checked
end