require 'Qt4' class Test<Qt::TextEdit def keyPressEvent(e) if(e.key()==Qt::Key_Enter || e.key()==Qt::Key_Return) text=$ptxt2.toPlainText() $ptxt1.setPlainText(text) else super end end end app = Qt::Application.new(ARGV) $ptxt1=Test.new $ptxt2=Test.new $ptxt3=Test.new $ptxt4=Test.new spl1=Qt::Splitter.new(Qt.Horizontal) spl3=Qt::Splitter.new(Qt.Vertical,spl1) spl4=Qt::Splitter.new(Qt.Vertical,spl1) spl3.addWidget($ptxt1) spl3.addWidget($ptxt2) spl4.addWidget($ptxt3) spl4.addWidget($ptxt4) font = Qt::Font.new font.family = "Courier New" font.pointSize = 12 font.bold = true font.weight = 75 $ptxt1.font = font $ptxt2.font = font $ptxt3.font = font $ptxt4.font = font $ptxt2.setFocus spl1.resize(500, 500) spl1.show() spl3.show() app.exec()
I tried to change the encoding, nothing happened. It is necessary that the Russian text written in one window ($ ptxt2) is correctly displayed in another window ($ ptxt1).