Class: Qt::Variant
Constant Summary
collapse
- String =
Qt::Enum.new(10, "QVariant::Type")
- Date =
Qt::Enum.new(14, "QVariant::Type")
- Time =
Qt::Enum.new(15, "QVariant::Type")
- DateTime =
Qt::Enum.new(16, "QVariant::Type")
Instance Method Summary
collapse
Methods inherited from Base
#%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #QCOMPARE, #QEXPECT_FAIL, #QFAIL, #QSKIP, #QTEST, #QVERIFY, #QVERIFY2, #QWARN, #^, ancestors, #is_a?, #methods, private_slots, #protected_methods, #public_methods, q_classinfo, q_signal, q_slot, signals, #singleton_methods, slots, #|, #~
Constructor Details
#initialize(*args) ⇒ Variant
Returns a new instance of Variant.
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
|
# File 'lib/Qt/qtruby4.rb', line 2194
def initialize(*args)
if args.size == 1 && args[0].nil?
return super()
elsif args.size == 1 && args[0].class.name == "Date"
return super(Qt::Date.new(args[0]))
elsif args.size == 1 && args[0].class.name == "DateTime"
return super(Qt::DateTime.new( Qt::Date.new(args[0].year, args[0].month, args[0].day),
Qt::Time.new(args[0].hour, args[0].min, args[0].sec) ) )
elsif args.size == 1 && args[0].class.name == "Time"
return super(Qt::Time.new(args[0]))
elsif args.size == 1 && args[0].class.name == "BigDecimal"
return super(args[0].to_f) else
return super(*args)
end
end
|
Instance Method Details
2319
2320
2321
2322
|
# File 'lib/Qt/qtruby4.rb', line 2319
def inspect
str = super
str.sub(/>$/, " typeName=%s>" % typeName)
end
|
#load(*args) ⇒ Object
2329
2330
2331
|
# File 'lib/Qt/qtruby4.rb', line 2329
def load(*args)
method_missing(:load, *args)
end
|
#pretty_print(pp) ⇒ Object
2324
2325
2326
2327
|
# File 'lib/Qt/qtruby4.rb', line 2324
def pretty_print(pp)
str = to_s
pp.text str.sub(/>$/, " typeName=%s>" % typeName)
end
|
2211
2212
2213
|
# File 'lib/Qt/qtruby4.rb', line 2211
def to_a
return toStringList()
end
|
2215
2216
2217
|
# File 'lib/Qt/qtruby4.rb', line 2215
def to_f
return toDouble()
end
|
2219
2220
2221
|
# File 'lib/Qt/qtruby4.rb', line 2219
def to_i
return toInt()
end
|
2223
2224
2225
|
# File 'lib/Qt/qtruby4.rb', line 2223
def to_int
return toInt()
end
|
#type(*args) ⇒ Object
2333
2334
2335
|
# File 'lib/Qt/qtruby4.rb', line 2333
def type(*args)
method_missing(:type, *args)
end
|
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
|
# File 'lib/Qt/qtruby4.rb', line 2227
def value
case type()
when Qt::Variant::Invalid
return nil
when Qt::Variant::Bitmap
when Qt::Variant::Bool
return toBool
when Qt::Variant::Brush
return qVariantValue(Qt::Brush, self)
when Qt::Variant::ByteArray
return toByteArray
when Qt::Variant::Char
return qVariantValue(Qt::Char, self)
when Qt::Variant::Color
return qVariantValue(Qt::Color, self)
when Qt::Variant::Cursor
return qVariantValue(Qt::Cursor, self)
when Qt::Variant::Date
return toDate
when Qt::Variant::DateTime
return toDateTime
when Qt::Variant::Double
return toDouble
when Qt::Variant::Font
return qVariantValue(Qt::Font, self)
when Qt::Variant::Icon
return qVariantValue(Qt::Icon, self)
when Qt::Variant::Image
return qVariantValue(Qt::Image, self)
when Qt::Variant::Int
return toInt
when Qt::Variant::KeySequence
return qVariantValue(Qt::KeySequence, self)
when Qt::Variant::Line
return toLine
when Qt::Variant::LineF
return toLineF
when Qt::Variant::List
return toList
when Qt::Variant::Locale
return qVariantValue(Qt::Locale, self)
when Qt::Variant::LongLong
return toLongLong
when Qt::Variant::Map
return toMap
when Qt::Variant::Palette
return qVariantValue(Qt::Palette, self)
when Qt::Variant::Pen
return qVariantValue(Qt::Pen, self)
when Qt::Variant::Pixmap
return qVariantValue(Qt::Pixmap, self)
when Qt::Variant::Point
return toPoint
when Qt::Variant::PointF
return toPointF
when Qt::Variant::Polygon
return qVariantValue(Qt::Polygon, self)
when Qt::Variant::Rect
return toRect
when Qt::Variant::RectF
return toRectF
when Qt::Variant::RegExp
return toRegExp
when Qt::Variant::Region
return qVariantValue(Qt::Region, self)
when Qt::Variant::Size
return toSize
when Qt::Variant::SizeF
return toSizeF
when Qt::Variant::SizePolicy
return toSizePolicy
when Qt::Variant::String
return toString
when Qt::Variant::StringList
return toStringList
when Qt::Variant::TextFormat
return qVariantValue(Qt::TextFormat, self)
when Qt::Variant::TextLength
return qVariantValue(Qt::TextLength, self)
when Qt::Variant::Time
return toTime
when Qt::Variant::UInt
return toUInt
when Qt::Variant::ULongLong
return toULongLong
when Qt::Variant::Url
return toUrl
end
return qVariantValue(nil, self)
end
|