Working with OK Button ! - Linux

This is a discussion on Working with OK Button ! - Linux ; Hi, Iam trying to implement a Qt GUI for the very first time. I have been able to get a small GUI form with 2 Edit boxes. Apart from 2 Edit Boxes there is one 'Ok' button and a 'Cancel' ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Working with OK Button !

  1. Working with OK Button !

    Hi,
    Iam trying to implement a Qt GUI for the very first time. I have been
    able to get a small GUI form with 2 Edit boxes. Apart from 2 Edit
    Boxes there is one 'Ok' button and a 'Cancel' Button.

    All I want is to use the Ok button. I want to implement some code to
    be executed when I press the 'ok'.
    In MFC, I know that OnOk( ) function is invoked by default on
    pressing Ok button

    I am not aware of similar thing ( if any ) in qt4.

    I know my query is very basic but I am struggling in initial steps.

    I can provide more details about the code if required.

    All I want is to execute some code/function to be executed on pressing
    the Ok button.

    Any kind of help would be appreciated.

    Thanks in Advance,
    guddu.

  2. Re: Working with OK Button !

    Hi,

    [...]
    > All I want is to use the Ok button. I want to implement some code to
    > be executed when I press the 'ok'.
    > In MFC, I know that OnOk( ) function is invoked by default on
    > pressing Ok button


    Which is a very ugly unnormality because if you define some "myFunction"
    button, you'll have to use some kind of callback anyway - which is not
    pre-defined... Which is just what to do in QT. So there is no predefined
    callback for "special" buttons.

    > I am not aware of similar thing ( if any ) in qt4.


    Just the same as with all QT buttons. Write a callback (basically the
    same as the "OnOK" function. Here comes the difference: You can give it
    any name you like. Doesn't matter. Call it "OnOK" if you want. And: you
    have to register the callback!

    Check the QT tutorial for buttons. It's really simple, though I've been
    using it only once long ago ;-)

    Have fun ;-)

+ Reply to Thread