Class: Qt::AdaptiveGridLayout
- Inherits:
-
GridLayout
- Object
- GridLayout
- Qt::AdaptiveGridLayout
- Defined in:
- lib/cosmos/gui/qt.rb
Instance Method Summary collapse
Methods inherited from GridLayout
Constructor Details
This class inherits a constructor from Qt::GridLayout
Instance Method Details
#addWidget(widget) ⇒ Object
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/cosmos/gui/qt.rb', line 788 def addWidget() case (count() + 1) when 3 # reorder things to add a second column old = takeAt(1) addItem(old, 0, 1) super() when 7 # reorder everything to add a third column items = [] # Take the items in reverse order because taking an item changes the indexes 5.downto(2).each {|index| items << takeAt(index)} # Reverse the items to get them back into insertion order items.reverse! addItem(items[0], 0, 2) addItem(items[1], 1, 0) addItem(items[2], 1, 1) addItem(items[3], 1, 2) super() # When we have established the desired number of rows we can add things and GridLayout does the right thing else super() end end |