How to connect the object created by Qt-Creator to the class



  • Hi,

    I`m a newbie on QT. Could anyone tell me how to connect the objected created in Creator to the new class type, e.g., I created a LCDnumber in QTCreator with the name of 'lcd1', I also created a new LCD in the mainwindows.cpp, how to connect this new LCD to 'lcd1'? Because the properties of 'lcd1' can be easily defined in QtCreator,

    Thanks in advance!


  • Lifetime Qt Champion

    Hi,

    Your description is not really clear. What do you mean by connect ? Connect like in "signals and slots" ? What do you want to connect to lcd1 ?



  • Hi, thanks for yor reply. The connection means make them exactly the same. Design the LCD in the QT creator,(for the position design) and define it in the mainwindows.cpp by lcd=new LCDnumber....;

    Actually, the original class is the QWT-dial which I load from the QWT example. I used LCDnumber as an example above. I defined a new dial with the dial class, but I also created a dial in the QTcreator by the plugin of QWT. Now, I want to make these two dials as the same one.


  • Lifetime Qt Champion

    Can you show your current code ?



  • Hi,

    I include the class "speedo_meter" from the QWT example, and create the object in the mainwindow.cpp:
    @
    d_speedo = new SpeedoMeter( this);
    d_speedo->setScaleStepSize( 20.0 );
    d_speedo->setScale( 0.0, 240.0 );
    d_speedo->scaleDraw()->setPenWidth( 2 );
    @
    I also add a dialMater in the QtCreator with the name of DIAL, how can I make these two objects into the same one?
    [edit: added missing coding tags @ SGaist]


  • Lifetime Qt Champion

    Do you mean create a custom widget containing both the SpeedoMeter and the dial ?


Log in to reply
 

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