Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] emit crashes on QGraphicsView



  • i've added a signal in a QGraphicsView deriven class. when i call "emit" i get crashes.
    can't resolve it :(

    EDITED: (code added)

    @class editor: public QGraphicsView
    {
    Q_OBJECT

    public:
    editor(QWidget *parent);

    signals:
    void rectSizeChanged(int w, int h);
    };@


  • Moderators

    That should work. Perhaps moc info has not been updated? Please clean your project, run qmake and rebuild it.



  • tried that hundred times, not works :(

    it should be added that i get that crash in cpp code

    @
    emit rectSizeChanged(100, 100); //POWW
    @


  • Moderators

    Weird. Perhaps you are running a threaded application? Maybe the signal is sent to some thread with a DirectCall instead of a Qt::QueuedConnection?


  • Lifetime Qt Champion

    Hi,

    To add to sierdzio, are you sure it's not on the receiver's end that the crash happens (thinking of a direct connection) ?



  • @SGalst: yeah ;)

    @slerdzlo: you were right. actually that "emit" was called within a function which was controlled from another friend class of "QGraphicsItem". i didn't care about the thready work of QGraphicsView and the scenes inside it.

    so i moved signals into the graphics item class and added a getter function to the graphics view which returns a pointer to that graphics item. now, main widget will get signals directly from the graphics item.

    thank you very much.


Log in to reply