Class: Console
- Inherits:
-
Qt::TableWidget
- Object
- Qt::TableWidget
- Console
- Defined in:
- lib/class/Console.rb
Instance Method Summary collapse
-
#initialize(console) ⇒ Console
constructor
A new instance of Console.
- #print(msg) ⇒ Object
Constructor Details
#initialize(console) ⇒ Console
Returns a new instance of Console.
13 14 15 16 |
# File 'lib/class/Console.rb', line 13 def initialize(console) super() @console = console end |
Instance Method Details
#print(msg) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/class/Console.rb', line 18 def print(msg) @console.insertRow(@console.rowCount) time = Qt::TableWidgetItem.new("#{Time.now.strftime("%d/%m %H:%M")}") time.setFlags(Qt::ItemIsEnabled) msg = Qt::TableWidgetItem.new(msg) msg.setFlags(Qt::ItemIsEnabled) @console.setItem(@console.rowCount - 1, 0, time) @console.setItem(@console.rowCount - 1, 1, msg) @console.scrollToItem(time, Qt::AbstractItemView::EnsureVisible) end |