Class: Qt::DateTime
Instance Method Summary collapse
-
#initialize(*args) ⇒ DateTime
constructor
A new instance of DateTime.
- #inspect ⇒ Object
- #pretty_print(pp) ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize(*args) ⇒ DateTime
Returns a new instance of DateTime.
691 692 693 694 695 696 697 698 699 700 701 702 703 |
# File 'lib/Qt/qtruby4.rb', line 691 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
#inspect ⇒ Object
715 716 717 718 |
# File 'lib/Qt/qtruby4.rb', line 715 def inspect str = super str.sub(/>$/, " %s>" % toString) end |
#pretty_print(pp) ⇒ Object
720 721 722 723 |
# File 'lib/Qt/qtruby4.rb', line 720 def pretty_print(pp) str = to_s pp.text str.sub(/>$/, " %s>" % toString) end |
#to_time ⇒ Object
705 706 707 708 709 710 711 712 713 |
# File 'lib/Qt/qtruby4.rb', line 705 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 |