[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bindings
Subject: Re: [Kde-bindings] RubyQt getting output when app quit
From: Yvon Thoraval <yvon.thoraval () gmail ! com>
Date: 2015-04-01 12:45:34
Message-ID: CAG6bkBy03PYsANfz_VGoXy74E=L3f+XaiUL-1SVcC8ovBwSoTA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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@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@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@kde.org
>> https://mail.kde.org/mailman/listinfo/kde-bindings
>>
>>
>
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings@kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
>
>
[Attachment #5 (text/html)]
<div dir="ltr">Fine tanx a lot, this works great, exactly what I wanted.<div>Actually the <span \
style="font-size:12.8000001907349px">closeEvent(event is attached to the upper-left red button of the \
window.</span></div><div><span style="font-size:12.8000001907349px">How about attaching this event to a \
"Quit" button ?</span></div><div><span \
style="font-size:12.8000001907349px"><br></span></div><div><span \
style="font-size:12.8000001907349px">Best,</span></div><div><span \
style="font-size:12.8000001907349px"><br></span></div><div><span \
style="font-size:12.8000001907349px">Yvon</span></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">2015-03-31 22: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"><div \
dir="ltr">Can't get what you want exactly, but you can try this simple \
app:<div><br></div><div><div>require 'Qt4'</div><div><br></div><div>class Window < \
Qt::Widget</div><div><br></div><div> def initialize(values)</div><div> super(nil) # no \
parent</div><div><br></div><div> @combo = Qt::ComboBox.new</div><div> \
@combo.addItems(values)</div><div> @layout = Qt::VBoxLayout.new</div><div> \
@layout.addWidget(@combo)</div><div><br></div><div> self.windowTitle = "Combo \
App"</div><div> self.resize(300, 50)</div><div> self.layout = @layout</div><div> \
end</div><div><br></div><div> def closeEvent(event)</div><div> puts @combo.currentText</div><div> \
end</div><div><br></div><div>end</div><div><br></div><div>if $0 == __FILE__</div><div> app = \
Qt::Application.new(ARGV) # you may use the QApplication lastWindowClosed</div><div> win = \
Window.new(('A'..'Z').to_a)</div><div> win.show</div><div> \
app.exec</div><div>end</div></div><div><br></div><div><a href="http://pastebin.com/CxtiA3SP" \
target="_blank">http://pastebin.com/CxtiA3SP</a><br></div></div><div class="gmail_extra"><br><div \
class="gmail_quote"><div><div class="h5">On Sun, Mar 29, 2015 at 4:11 PM, Yvon Thoraval <span \
dir="ltr"><<a href="mailto:yvon.thoraval@gmail.com" \
target="_blank">yvon.thoraval@gmail.com</a>></span> wrote:<br></div></div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div \
class="h5"><div dir="ltr">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.<div>this little app will be use from command line \
that's the reason i want the choosen value to \
STDOUT.</div><div><br></div><div>best.</div><div><br></div></div> \
<br></div></div>_______________________________________________<br> Kde-bindings mailing list<br>
<a href="mailto:Kde-bindings@kde.org" target="_blank">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></blockquote></div><br></div> <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></blockquote></div><br></div>
[Attachment #6 (text/plain)]
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic