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



271
272
273
274
# File 'lib/ruber/qt_sugar.rb', line 271

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



242
243
244
245
246
# File 'lib/ruber/qt_sugar.rb', line 242

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



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

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



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

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