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

+ (Object) _load(str)



136
137
138
139
# File 'lib/ruber/qt_sugar.rb', line 136

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

+ (Object) yaml_new(cls, tag, val)



112
113
114
115
# File 'lib/ruber/qt_sugar.rb', line 112

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

- (Object) _dump(_)



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

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

- (Object) to_yaml(opts = {})



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

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