Results 1 to 7 of 7

Thread: signal-slot issue, how to create a signal when a Qlist is updated

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2014
    Posts
    26
    Qt products
    Qt5
    Platforms
    Windows

    Default signal-slot issue, how to create a signal when a Qlist is updated

    Hi,

    I am re-posting my question. This time I hope I am more clear.

    In my GraphicView I have an event:
    Qt Code:
    1. void MyGraphicsView::mousePressEvent(QMouseEvent * e)
    2. {
    3. if (e->buttons().testFlag(Qt::MidButton))
    4. {
    5. double rad = 2;
    6. QPointF pt = mapToScene(e->pos());
    7. QPen myPen = QPen(Qt::red);
    8. this->Scene->addEllipse(pt.x()-rad, pt.y()-rad, rad*2.0, rad*2.0,myPen, QBrush(Qt::SolidPattern));
    9. this->list.append(pt);
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 
    I want to create a connection between my main window's QLabel and MyGraphicsView::list.append(pt); that every time a new value is added to the list, pt will be printed on QLabel of the main window.
    I can create a slot in my main window that will print a string on QLabel but I don't know what will be my signal and how the connection command will be look like.
    Basically, I don't know how to create a signal when a list is updated.

    I hope I can get help on this matter.

    Thank,
    Last edited by anda_skoa; 3rd March 2014 at 21:38. Reason: missing [code] tags

Similar Threads

  1. a signal-slot issue
    By ceraolo in forum Newbie
    Replies: 2
    Last Post: 28th April 2012, 18:30
  2. Signal from QList Object to Slot from parent
    By Rocken in forum Qt Programming
    Replies: 4
    Last Post: 9th April 2012, 14:34
  3. Signal / Slot issue
    By sicker in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2011, 21:53
  4. Signal and Slot Issue
    By dlrlsqa1 in forum Newbie
    Replies: 5
    Last Post: 23rd March 2009, 12:44
  5. queued signal/slot connection with QList<int>
    By smalls in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 14:32

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.