Results 1 to 4 of 4

Thread: calling a function with objects

  1. #1
    Join Date
    Jul 2014
    Posts
    39
    Qt products
    Qt5
    Platforms
    Windows

    Default calling a function with objects

    Hello guys
    I want to call a function which is in a class and this class is in another class meand two classes are nested and the inner class contains on function and i want to use that function in some other class means there are 3 classes one clsss(class a) and two nested classes (class b,c)one in another and the inner class has the function which i want to acess in the 1st class.i am using objects to call the function but its now working means i created object of class b and onject of class c and with object of class c i call the function which needs to call and this claiing is done in class b and then with object of class b i amd clling the function of class b in class a.
    But its not working.and the function which i need to call is used for slots.

    I am doing correct or is there any other method

    Please help guys i really need it.

    Its like this

    void player::ya()
    { display vp; vp.p();

    }

    void display:()
    { power media; media.play();

    }
    player is a class display is a class and power is class vp is object and media is object p is function and play is function, ya() is also a function.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: calling a function with objects

    So what exactly is the problem? The code above is correct and should work fine.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2014
    Posts
    39
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: calling a function with objects

    But the function which i need to call is not getting called and the function is connected to a push button when i press that push button its not calling it, actually when i press the push button nothing happens.

    And I am trying to build a video player who has two classes, one has controls for tha video player like play button, slider etc. and other class has display (screen).I created two diffrent classes coz i want screen to be in one window and controls in another window.so when i hit the play button video shuld display on other window which has screen but its not showing any thing before that i open the file means select the file this is done with only one object and it works but when i use one more object to call a function from one more class it doesnt work.Please help

    P.S. i already build a video player,but the videolayer has all the things in oone window meand screen and controls but now iwant screen to be in other window.
    Last edited by herculis; 28th August 2014 at 09:59.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: calling a function with objects

    Quote Originally Posted by herculis View Post
    But the function which i need to call is not getting called and the function is connected to a push button when i press that push button its not calling it, actually when i press the push button nothing happens.
    Show the actual code instead of some mockup.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Calling function in a widget's destructor
    By fiodis in forum Newbie
    Replies: 4
    Last Post: 5th December 2012, 18:54
  2. Calling external DLL function with Qt
    By yaba in forum Newbie
    Replies: 2
    Last Post: 29th September 2011, 07:47
  3. SIGNAL/SLOT Calling the same function. Possible?
    By matthieunc in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2011, 23:24
  4. QtConncurrent - calling function within the class
    By jacek_ in forum Qt Programming
    Replies: 5
    Last Post: 28th October 2009, 17:37
  5. Problems calling C function in C++/Qt class
    By Rayven in forum General Programming
    Replies: 2
    Last Post: 2nd June 2006, 21:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.