Class: Qt::PointF

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



134
135
136
137
# File 'lib/ruber/qt_sugar.rb', line 134

def self._load str
  x, y = str.split ';'
  self.new x.to_f, y.to_f
end

.yaml_new(cls, tag, val) ⇒ Object



110
111
112
113
# File 'lib/ruber/qt_sugar.rb', line 110

def self.yaml_new cls, tag, val
  x, y= val['x'], val['y']
  Qt::PointF.new(x.to_f, y.to_f)
end

Instance Method Details

#_dump(_) ⇒ Object



126
127
128
129
130
131
132
# File 'lib/ruber/qt_sugar.rb', line 126

def _dump _
  loc = Qt::Locale.c
  loc.number_options = Qt::Locale::OmitGroupSeparator
  sx = loc.to_string( self.x )
  sy = loc.to_string( self.y )
  "#{sx};#{sy}"
end

#to_yaml(opts = {}) ⇒ Object



115
116
117
118
119
120
121
122
123
124
# File 'lib/ruber/qt_sugar.rb', line 115

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 'x', loc.to_string( self.x )
      map.add 'y', loc.to_string( self.y )
    end
  end
end