Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to connect the object created by Qt-Creator to the class
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    liuqc
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        liuqc
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you show your current code ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • L Offline
            L Offline
            liuqc
            wrote on last edited by
            #5

            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]

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved