Class: Qt::MatrixLayout

Inherits:
GridLayout show all
Defined in:
lib/cosmos/gui/qt.rb

Instance Method Summary collapse

Constructor Details

#initialize(num_columns) ⇒ MatrixLayout

Returns a new instance of MatrixLayout.



714
715
716
717
718
719
# File 'lib/cosmos/gui/qt.rb', line 714

def initialize(num_columns)
  super(nil)
  @num_columns = num_columns
  @row = 0
  @col = 0
end

Instance Method Details

#addLayout(layout) ⇒ Object



730
731
732
733
734
735
736
737
# File 'lib/cosmos/gui/qt.rb', line 730

def addLayout(layout)
  super(layout, @row, @col)
  @col += 1 if @col < @num_columns
  if @col == @num_columns
    @row += 1
    @col = 0
  end
end

#addWidget(widget) ⇒ Object



721
722
723
724
725
726
727
728
# File 'lib/cosmos/gui/qt.rb', line 721

def addWidget(widget)
  super(widget, @row, @col)
  @col += 1 if @col < @num_columns
  if @col == @num_columns
    @row += 1
    @col = 0
  end
end