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

  • !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.

    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.

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

  • 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
    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 tovtable for MeasuramentGraphic'
    measuramentgraphic.o:-1: In function ZN18MeasuramentGraphicC2Ev': measuramentgraphic.cpp:5: error: undefined reference tovtable 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.

Log in to reply

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