Module: ModelUtils

Defined in:
lib/rui/toolkits/qtbase/qt.rb

Instance Method Summary collapse

Instance Method Details

#inserting_rows(parent, first, last) ⇒ Object

Helper method to insert model rows from within a block. This method ensures that the appropriate begin/end functions are called.



483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/rui/toolkits/qtbase/qt.rb', line 483

def inserting_rows(parent, first, last)
  if first > last
    yield
  else
    begin
      begin_insert_rows(parent || Qt::ModelIndex.new, first, last)
      yield
    ensure
      end_insert_rows
    end
  end
end

#removing_rows(parent, first, last) ⇒ Object

Helper method to delete model rows from within a block. This method ensures that the appropriate begin/end functions are called.



466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/rui/toolkits/qtbase/qt.rb', line 466

def removing_rows(parent, first, last)
  if first > last
    yield
  else
    begin
      begin_remove_rows(parent || Qt::ModelIndex.new, first, last)
      yield
    ensure
      end_remove_rows
    end
  end
end