Class: Qt::RectF

Inherits:
Object show all
Defined in:
lib/ruber/qt_sugar.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(str) ⇒ Object



273
274
275
276
# File 'lib/ruber/qt_sugar.rb', line 273

def self._load str
  l, t, w, h = str.split ';'
  self.new l.to_f, t.to_f, w.to_f, h.to_f
end

.yaml_new(cls, tag, val) ⇒ Object



244
245
246
247
248
# File 'lib/ruber/qt_sugar.rb', line 244

def self.yaml_new cls, tag, val
  left, top, width, height= val['left'], val['top'], val['width'], 
      val['height']
  Qt::RectF.new(left.to_f, top.to_f, width.to_f, height.to_f)
end

Instance Method Details

#_dump(_) ⇒ Object



263
264
265
266
267
268
269
270
271
# File 'lib/ruber/qt_sugar.rb', line 263

def _dump _
  loc = Qt::Locale.c
  loc.number_options = Qt::Locale::OmitGroupSeparator
  sl = loc.to_string left
  st = loc.to_string top
  sw = loc.to_string width
  sh = loc.to_string height
  "#{sl};#{st};#{sw};#{sh}"
end

#to_yaml(opts = {}) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/ruber/qt_sugar.rb', line 250

def to_yaml opts = {}
  YAML.quick_emit(self, opts) do |out|
    out.map(taguri, to_yaml_style) do |map|
      loc = Qt::Locale.c
      loc.number_options = Qt::Locale::OmitGroupSeparator
      map.add 'left', loc.to_string(left)
      map.add 'top', loc.to_string(top)
      map.add 'width', loc.to_string(width)
      map.add 'height', loc.to_string(height)
    end
  end
end