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



191
192
193
194
195
196
197
198
199
200
201
# File 'lib/rui/toolkits/qtbase/gui_builder.rb', line 191

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