Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, May 2008
Question on QLCDNumber, SIGNAL, SLOT


Message 1 in thread

Hello All
 
Problem I am facing - bit of code to illustrate the issue
 
I have a widget fooApp (base class QFrame) which has some graphics operation; And
any change in area of the graphic object has to be displayed in QLCDNumber which is
a property of another widget barApp (base class QWidget). 
 
In the class definition of fooApp, I have declared signals as void areaChanged(int val)
and am using the public slot void display(int val) declared in QLCDNumber. Further
I am calling connect() API as follows
 
connect(fooObj, SIGNAL(areaChanged(int)), barObj->lcd, SLOT(display(int)));
 
So a method in fooObj invokes emit areaChanged(newVal); when the area value changes
This should display the changed value in the LCD display. But that does not happen
I guess there is something that I am missing. Could anyone advice me ?
 
 
Thanks in advance
Srihari



      

Message 2 in thread

Hi,

If you run your app in Debug mode, do you see any problems with the connection? Failed connections are reported in debug mode. 
Also: are you sure:
1) your signal fires
2) barObj->lcd really should not read barObj->lcd()
3) your connect statement is actually executed?

André
  "Srihari Parimi" <srihari_parimi@xxxxxxxxx> schreef in bericht news:126319.26803.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        Hello All



        Problem I am facing - bit of code to illustrate the issue



        I have a widget fooApp (base class QFrame) which has some graphics operation; And
        any change in area of the graphic object has to be displayed in QLCDNumber which is
        a property of another widget barApp (base class QWidget). 



        In the class definition of fooApp, I have declared signals as void areaChanged(int val)
        and am using the public slot void display(int val) declared in QLCDNumber. Further
        I am calling connect() API as follows



        connect(fooObj, SIGNAL(areaChanged(int)), barObj->lcd, SLOT(display(int)));



        So a method in fooObj invokes emit areaChanged(newVal); when the area value changes

        This should display the changed value in the LCD display. But that does not happen

        I guess there is something that I am missing. Could anyone advice me ?





        Thanks in advance

        Srihari