Results 1 to 4 of 4

Thread: how to use dragMove()..

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    123
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: how to use dragMove()..

    Hi Rajesh,

    thanks for your code. but unfortunately i'm using older version of qt(qt-3.3.5). in that i dont have QMimeData etc. but let me go through the code and try to adapt with teh functions in qt-3.3.5. but i think the problem in my code was that i used QPixmap::load() function to display the image. and then drag this image to the drop widget. this is my code:

    Qt Code:
    1. static void addStuff( QWidget * parent, bool image, bool secret = FALSE )
    2. {
    3. QVBoxLayout * tll = new QVBoxLayout( parent);
    4. if(image)
    5. {
    6. drag *drg = new drag(parent);
    7. drag *drg1 = new drag(parent);
    8. tll->addWidget( drg );
    9. tll->addWidget( drg1 );
    10. QPixmap stuff;
    11. QPixmap stuff1;
    12. if(stuff.load( "trolltech.bmp" )); ----i think this caused my image not to be moved---
    13. itemname[0]=1;
    14. stuff1.load( "butterfly.png" );
    15. drg->setPixmap( stuff );
    16. drg1->setPixmap( stuff1 );
    17. }
    18. else
    19. {
    20. drop *drp= new drop(parent);
    21. drop *drp1= new drop(parent);
    22. tll->addWidget( drp );
    23. tll->addWidget( drp1 );
    24. drp->setText("Drop the items");
    25. drp->setFont(QFont("Helvetica",12));
    26. drp1->setText("Drag and Drop");
    27. drp1->setFont(QFont("Helvetica",12));
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 
    .

    thinking of using QIconview. any suggestions ?

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: how to use dragMove()..

    I dont know about Qpixmap::load. but in your previous code you creating a new object and not deleteing old object. so it will create a copy of new widget.
    mainly whenever you create a new widget then delete or close old widget.

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
  •  
Qt is a trademark of The Qt Company.