Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'Qt4'
- class Window < Qt::Widget
- def initialize(values)
- super(nil) # no parent
- @combo = Qt::ComboBox.new
- @combo.addItems(values)
- @layout = Qt::VBoxLayout.new
- @layout.addWidget(@combo)
- self.windowTitle = "Combo App"
- self.resize(300, 50)
- self.layout = @layout
- end
- def closeEvent(event)
- puts @combo.currentText
- end
- end
- if $0 == __FILE__
- app = Qt::Application.new(ARGV) # you may use the QApplication lastWindowClosed
- win = Window.new(('A'..'Z').to_a)
- win.show
- app.exec
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement