Class: Qt::SizeF

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



201
202
203
204
# File 'lib/ruber/qt_sugar.rb', line 201

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

.yaml_new(cls, tag, val) ⇒ Object



177
178
179
180
# File 'lib/ruber/qt_sugar.rb', line 177

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

Instance Method Details

#_dump(_) ⇒ Object



193
194
195
196
197
198
199
# File 'lib/ruber/qt_sugar.rb', line 193

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

#to_yaml(opts = {}) ⇒ Object



182
183
184
185
186
187
188
189
190
191
# File 'lib/ruber/qt_sugar.rb', line 182

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 'width', loc.to_string(width)
      map.add 'height', loc.to_string(height)
    end
  end
end