[Kde-bindings] RubyQt getting output when app quit

Yvon Thoraval yvon.thoraval at gmail.com
Wed Apr 1 12:45:34 UTC 2015


Fine tanx a lot, this works great, exactly what I wanted.
Actually the closeEvent(event is attached to the upper-left red button of
the window.
How about attaching this event to a "Quit" button ?

Best,

Yvon

2015-03-31 22:19 GMT+02:00 Abdelrahman Ghanem <abom.jdev at gmail.com>:

> Can't get what you want exactly, but you can try this simple app:
>
> 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
>
> http://pastebin.com/CxtiA3SP
>
> On Sun, Mar 29, 2015 at 4:11 PM, Yvon Thoraval <yvon.thoraval at gmail.com>
> wrote:
>
>> I'm trying a simple app it shows in a combobox some values and I want to
>> output the choosen value when quitting the app.
>> this little app will be use from command line that's the reason i want
>> the choosen value to STDOUT.
>>
>> best.
>>
>>
>> _______________________________________________
>> Kde-bindings mailing list
>> Kde-bindings at kde.org
>> https://mail.kde.org/mailman/listinfo/kde-bindings
>>
>>
>
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20150401/3a9556de/attachment.html>


More information about the Kde-bindings mailing list