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.
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
|
# File 'lib/Qt/qtruby4.rb', line 2228
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
2353
2354
2355
2356
|
# File 'lib/Qt/qtruby4.rb', line 2353
def inspect
str = super
str.sub(/>$/, " typeName=%s>" % typeName)
end
|
#load(*args) ⇒ Object
2363
2364
2365
|
# File 'lib/Qt/qtruby4.rb', line 2363
def load(*args)
method_missing(:load, *args)
end
|
#pretty_print(pp) ⇒ Object
2358
2359
2360
2361
|
# File 'lib/Qt/qtruby4.rb', line 2358
def pretty_print(pp)
str = to_s
pp.text str.sub(/>$/, " typeName=%s>" % typeName)
end
|
2245
2246
2247
|
# File 'lib/Qt/qtruby4.rb', line 2245
def to_a
return toStringList()
end
|
2249
2250
2251
|
# File 'lib/Qt/qtruby4.rb', line 2249
def to_f
return toDouble()
end
|
2253
2254
2255
|
# File 'lib/Qt/qtruby4.rb', line 2253
def to_i
return toInt()
end
|
2257
2258
2259
|
# File 'lib/Qt/qtruby4.rb', line 2257
def to_int
return toInt()
end
|
#type(*args) ⇒ Object
2367
2368
2369
|
# File 'lib/Qt/qtruby4.rb', line 2367
def type(*args)
method_missing(:type, *args)
end
|
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
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
|
# File 'lib/Qt/qtruby4.rb', line 2261
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
|