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. [Solved] Refresh LCD from QDial value changed doesn't work.
Forum Updated to NodeBB v4.3 + New Features

[Solved] Refresh LCD from QDial value changed doesn't work.

Scheduled Pinned Locked Moved General and Desktop
3 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.
  • R Offline
    R Offline
    Rhadel
    wrote on 8 Aug 2013, 10:57 last edited by
    #1

    !http://s12.postimg.org/olfjke5m5/voltage_Set.png(Voltimeter)!

    I ve created on a frame a QWidget with a voltimeter panel as shown at image.

    In Qt Creator I right-click on QDial, and then -->Go to Slot, and then valueChanged(int).

    It creates an slot on my class named @on_dial_valueChanged(int value) @
    Impementation of this method is:

    @
    qDebug() << "Changing dial: " << value;
    this->electro->setVolts(value); //Just for logical usage.
    this->ui->lcdNumber->display(electro->getVolts());
    @

    In order to change LCD value, but It doesn't work. It's never called when changing dialing. I think connect(...) method for signal is autoimplemented for Qt Creator, isnt?

    Thank you.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      butterface
      wrote on 8 Aug 2013, 13:41 last edited by
      #2

      Do you have a QApplication?
      Do you have Q_OBJECT where needed?
      Does the moc run?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rhadel
        wrote on 8 Aug 2013, 13:57 last edited by
        #3

        Hello, and thanks for your fast reply!

        I have a QApplication, and clean & moc runs Ok.

        I miss Q_OBJECT in custom QGraphicsObject class that handles the graphic paint, as shown:

        @
        class MeasuramentGraphic : public QGraphicsObject
        {
        Q_OBJECT
        public:
        explicit MeasuramentGraphic();
        (...)
        @

        I added it, but now, I have this compile-time issue:

        @
        ....stimulatorgraphic.o:-1: In function ZN18MeasuramentGraphicD1Ev': measuramentgraphic.h:11: error: undefined reference to vtable for MeasuramentGraphic'
        measuramentgraphic.o:-1: In function ZN18MeasuramentGraphicC2Ev': measuramentgraphic.cpp:5: error: undefined reference to vtable for MeasuramentGraphic'
        (...)
        @

        I have all the needed headers in its correct place.

        --------------------- EDIT------------------------

        Thank you again for your fast reply. To fix it, I just cleaned & build again, like that, moc generates new .o files. It compiles, and runs Ok. Thank you.

        1 Reply Last reply
        0

        1/3

        8 Aug 2013, 10:57

        • Login

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