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] emit crashes on QGraphicsView

[SOLVED] emit crashes on QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.0k 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.
  • M Offline
    M Offline
    mohsen
    wrote on last edited by
    #1

    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);
    };@

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

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

      (Z(:^

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mohsen
        wrote on last edited by
        #3

        tried that hundred times, not works :(

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

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

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

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

          (Z(:^

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

            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) ?

            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
            • M Offline
              M Offline
              mohsen
              wrote on last edited by
              #6

              @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.

              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