Access QTimer from diffrent Multiple class



  • Hello All,

    I am trying to access timer function of one class(Dialog) from another class(Menu) and trying to start and stop timer.

    I have One class Dialog and Another Class Menu.

    And defined a QTimer in Dialog
    @
    public: MenuWindow *myMenuWindow, *Menuclose;
    QTimer *QDTimer;
    QTimer *QTDiagLck;
    @
    and I am try to use this timer from another class but i am not able to access
    //IN DIALOG.CPP I HAVE DEFINED THE FUNCTION BELOW
    @
    connect(QTDiagLck,SIGNAL(timeout()),this,SLOT(ScreenLck()));
    @

    and to call ScreenLck() function from Dialog;

    //Defined in Menu header file class;
    @
    Dialog *DMenu;

    //IN CPP
    void MenuWindow::OpenScreenWindow() //--1
    {
    DMenu->QTDiagLck->start(50);

    }
    @

    but the time is not start whether it hangs the Application

    Suggest any thing , I will be thankful;

    Regads
    Praveen



  • If I did what you asked, but I'll try:
    Maybe you can create a "SLOT" in its class "Dialog" and call:
    @connect(QTDiagLck, SIGNAL(timeout()), QTDiagLck, SLOT(cutomSlot()));@

    Or if you want to access the variable maybe you can create a "getter".


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.