Class: Qt::DateTime
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) ⇒ DateTime
Returns a new instance of DateTime.
675
676
677
678
679
680
681
682
683
684
685
686
687
|
# File 'lib/Qt/qtruby4.rb', line 675
def initialize(*args)
if args.size == 1 && args[0].class.name == "DateTime"
return super( 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"
result = super( Qt::Date.new(args[0].year, args[0].month, args[0].day),
Qt::Time.new(args[0].hour, args[0].min, args[0].sec, args[0].usec / 1000) )
result.timeSpec = (args[0].utc? ? Qt::UTC : Qt::LocalTime)
return result
else
return super(*args)
end
end
|
Instance Method Details
699
700
701
702
|
# File 'lib/Qt/qtruby4.rb', line 699
def inspect
str = super
str.sub(/>$/, " %s>" % toString)
end
|
#pretty_print(pp) ⇒ Object
704
705
706
707
|
# File 'lib/Qt/qtruby4.rb', line 704
def pretty_print(pp)
str = to_s
pp.text str.sub(/>$/, " %s>" % toString)
end
|
689
690
691
692
693
694
695
696
697
|
# File 'lib/Qt/qtruby4.rb', line 689
def to_time
if timeSpec == Qt::UTC
return ::Time.utc( date.year, date.month, date.day,
time.hour, time.minute, time.second, time.msec * 1000 )
else
return ::Time.local( date.year, date.month, date.day,
time.hour, time.minute, time.second, time.msec * 1000 )
end
end
|