[Kde-bindings] RubyQt getting output when app quit

Yvon Thoraval yvon.thoraval at gmail.com
Fri Apr 3 05:34:40 UTC 2015


ok, clear, tanx a lot.


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

> Quoting from http://doc.qt.io/qt-4.8/qwidget.html#events
> "closeEvent() is called when the user closes the widget (or when
> close() is called)."
>
> See also http://doc.qt.io/qt-4.8/qwidget.html#closeEvent
>
> So just call close() when the "Quit" button is clicked:
>
> http://pastebin.com/cJauBqpB
>
>
> On 4/1/15, Yvon Thoraval <yvon.thoraval at gmail.com> wrote:
> > 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
> >>
> >>
> >
> _______________________________________________
> 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/20150403/fb8153bd/attachment.html>


More information about the Kde-bindings mailing list