Results 1 to 2 of 2

Thread: Callback in QT

  1. #1
    Join Date
    Aug 2007
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Callback in QT

    i have got a widget and a child of the same widget. if i drag and drop some image on child i want parent parent to be notified about the same. i want a callback function to be there in parent, which will be notified about droped contents in child widget.

    and i want QDragObject and drop coordinate information to be sent to that call back function in parent widget.


    class lab: public QLabel // this is child control
    {
    public:
    lab(QWidget *parent);

    protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dragLeaveEvent(QDragLeaveEvent *event);
    void dropEvent(QDropEvent *event);
    };

    class Thumbnail : public QWidget // this is parent in which child is created
    {
    Q_OBJECT
    public:
    Thumbnail(QWidget *parent = 0)
    {
    t = new lab(this);
    }
    ~Thumbnail();
    private:
    lab *t;

    }

    can you plz tell me how to write above said callback function.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Callback in QT

    Qt has signals and slots which are way more convenient to use than writing a callback mechanisms by hand.
    J-P Nurmi

Similar Threads

  1. QString static callback function from CURL
    By tpf80 in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2007, 20:47
  2. how to define the callback function in QThread?
    By cxl2253 in forum Qt Programming
    Replies: 6
    Last Post: 30th March 2007, 10:59
  3. (Callback API) and (Qt - SIGNAL/SLOT)
    By pytro in forum Qt Programming
    Replies: 19
    Last Post: 13th March 2007, 20:14
  4. Custom Event or Queued Connection ?
    By vishwanath in forum Qt Programming
    Replies: 2
    Last Post: 22nd November 2006, 13:55

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.