Results 1 to 6 of 6

Thread: dragging

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Arrow dragging

    Hi,
    I'm trying drag (and drop) of a text insert in a qlabel. But I see that drag event isn't called. Why? (maybe beacause on mywidget starts mouseMoveEvent also?)
    Thanks
    Qt Code:
    1. MyWidget::MyWidget( QWidget *parent, const char *name, const QGLWidget* shareWidget)
    2. : QGLWidget ( parent, name, shareWidget) {
    3.  
    4. this->setAcceptDrops(true);
    5. label = new QLabel("prove", this);
    6. }
    7.  
    8. void MyWidget::startDrag() {
    9. printf("start drag\n");
    10. QDragObject *d = new QTextDrag (this->label->text(), this);
    11. d->dragCopy();
    12. //do NOT delete d
    13. }
    14.  
    15. void MyWidget::dragEnterEvent(QDragEnterEvent* event) {
    16. printf("start drag enter event\n");
    17. event->accept(QTextDrag::canDecode(event) || QImageDrag::canDecode(event));
    18. }
    19.  
    20. void MyWidget::dropEvent(QDropEvent* event) {
    21. printf("start drop event\n");
    22. QImage image;
    23. QString text;
    24.  
    25. if (QImageDrag::decode(event, image)) {
    26. //insertImageAt(image, event->pos());
    27. }
    28. else if (QTextDrag::decode(event, text)) {
    29. //insertTextAt(text, event->pos());
    30. }
    31. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by mickey; 10th March 2006 at 14:24.
    Regards

Similar Threads

  1. Hover on mouse over while dragging
    By mooreaa in forum Qt Programming
    Replies: 3
    Last Post: 6th February 2010, 10:31
  2. QMainWindow Dragging is suspending QTimer
    By zaferaltug in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2009, 13:23
  3. Dragging to windows (pyqt)
    By amicitas in forum Newbie
    Replies: 1
    Last Post: 28th September 2008, 00:09
  4. Dragging mouse selection in QTableWidget
    By yartov in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2008, 15:03
  5. dragging
    By mickey in forum Newbie
    Replies: 1
    Last Post: 25th July 2006, 14:05

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.