Ok Button in Qt4 - Linux

This is a discussion on Ok Button in Qt4 - 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 3 of 3

Thread: Ok Button in Qt4

  1. Ok Button in Qt4

    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: Ok Button in Qt4

    On 2008-04-18, guddu wrote:
    > 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.


    You need to use the "signal" functions. "connect" is the one you want.

    QObject::connect(( const QObject * sender, const char * signal, const
    QObject * receiver, const char * method,
    Qt::ConnectionType type = Qt::AutoCompatConnection ) [static]

    Have you read the very fine documentation provided by the Trolltech
    devs?

    There's a great tutorial and demo with the docs.

    --
    Regards,

    Gregory.
    Gentoo Linux - Penguin Power

  3. Re: Ok Button in Qt4

    On 2008-04-18, Gregory Shearman wrote:
    > On 2008-04-18, guddu wrote:
    >> 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.

    >
    > You need to use the "signal" functions. "connect" is the one you want.
    >
    > QObject::connect(( const QObject * sender, const char * signal, const
    > QObject * receiver, const char * method,
    > Qt::ConnectionType type = Qt::AutoCompatConnection ) [static]
    >
    > Have you read the very fine documentation provided by the Trolltech
    > devs?
    >
    > There's a great tutorial and demo with the docs.
    >



    Oops! Sorry, there's an extra opening bracket in there... because of my
    lax copy/paste.

    Here's what it should be:

    QObject::connect( const QObject * sender, const char * signal, const
    QObject * receiver, const char * method,
    Qt::ConnectionType type = Qt::AutoCompatConnection ) [static]

    --
    Regards,

    Gregory.
    Gentoo Linux - Penguin Power

+ Reply to Thread