<div dir="ltr">ok, clear, tanx a lot.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-03 6:19 GMT+02:00 Abdelrahman Ghanem <span dir="ltr"><<a href="mailto:abom.jdev@gmail.com" target="_blank">abom.jdev@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Quoting from <a href="http://doc.qt.io/qt-4.8/qwidget.html#events" target="_blank">http://doc.qt.io/qt-4.8/qwidget.html#events</a><br>
"closeEvent() is called when the user closes the widget (or when<br>
close() is called)."<br>
<br>
See also <a href="http://doc.qt.io/qt-4.8/qwidget.html#closeEvent" target="_blank">http://doc.qt.io/qt-4.8/qwidget.html#closeEvent</a><br>
<br>
So just call close() when the "Quit" button is clicked:<br>
<br>
<a href="http://pastebin.com/cJauBqpB" target="_blank">http://pastebin.com/cJauBqpB</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 4/1/15, Yvon Thoraval <<a href="mailto:yvon.thoraval@gmail.com">yvon.thoraval@gmail.com</a>> wrote:<br>
> Fine tanx a lot, this works great, exactly what I wanted.<br>
> Actually the closeEvent(event is attached to the upper-left red button of<br>
> the window.<br>
> How about attaching this event to a "Quit" button ?<br>
><br>
> Best,<br>
><br>
> Yvon<br>
><br>
> 2015-03-31 22:19 GMT+02:00 Abdelrahman Ghanem <<a href="mailto:abom.jdev@gmail.com">abom.jdev@gmail.com</a>>:<br>
><br>
>> Can't get what you want exactly, but you can try this simple app:<br>
>><br>
>> require 'Qt4'<br>
>><br>
>> class Window < Qt::Widget<br>
>><br>
>>   def initialize(values)<br>
>>     super(nil) # no parent<br>
>><br>
>>     @combo = Qt::ComboBox.new<br>
>>     @combo.addItems(values)<br>
>>     @layout = Qt::VBoxLayout.new<br>
>>     @layout.addWidget(@combo)<br>
>><br>
>>     self.windowTitle = "Combo App"<br>
>>     self.resize(300, 50)<br>
>>     self.layout = @layout<br>
>>   end<br>
>><br>
>>   def closeEvent(event)<br>
>>     puts @combo.currentText<br>
>>   end<br>
>><br>
>> end<br>
>><br>
>> if $0 == __FILE__<br>
>>   app = Qt::Application.new(ARGV) # you may use the QApplication<br>
>> lastWindowClosed<br>
>>   win = Window.new(('A'..'Z').to_a)<br>
>>   win.show<br>
>>   app.exec<br>
>> end<br>
>><br>
>> <a href="http://pastebin.com/CxtiA3SP" target="_blank">http://pastebin.com/CxtiA3SP</a><br>
>><br>
>> On Sun, Mar 29, 2015 at 4:11 PM, Yvon Thoraval <<a href="mailto:yvon.thoraval@gmail.com">yvon.thoraval@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> I'm trying a simple app it shows in a combobox some values and I want to<br>
>>> output the choosen value when quitting the app.<br>
>>> this little app will be use from command line that's the reason i want<br>
>>> the choosen value to STDOUT.<br>
>>><br>
>>> best.<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Kde-bindings mailing list<br>
>>> <a href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br>
>>> <a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br>
>>><br>
>>><br>
>><br>
>> _______________________________________________<br>
>> Kde-bindings mailing list<br>
>> <a href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br>
>> <a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br>
>><br>
>><br>
><br>
_______________________________________________<br>
Kde-bindings mailing list<br>
<a href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br>
</div></div></blockquote></div><br></div>