Class: RUI::GuiBuilder::Layout

Inherits:
Object
  • Object
show all
Includes:
RUI::GuiBuilder
Defined in:
lib/rui/toolkits/qtbase/gui_builder.rb

Overview

A widget layout.

Two orientations are supported: horizontal and vertical. The orientation is controlled by the type attribute of this descriptor.

A margin can also be specified using the margin attribute.

Instance Method Summary collapse

Methods included from RUI::GuiBuilder

build, #build, #builder, #setup_widget

Instance Method Details

#create_element(window, parent, desc) ⇒ Object



168
169
170
171
172
173
174
175
176
177
178
# File 'lib/rui/toolkits/qtbase/gui_builder.rb', line 168

def create_element(window, parent, desc)
  factory = if desc.opts[:type] == :horizontal
    Qt::HBoxLayout
  else
    Qt::VBoxLayout
  end
  layout = factory.new
  layout.margin = desc.opts[:margin] if desc.opts[:margin]
  parent.add_layout(layout)
  layout
end