×

Discussion Board

Results 1 to 3 of 3

Thread: Drag issue

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    37

    Drag issue

    hi guys,
    I have attached my code where the control is not going to dragenterevent() from mouse press event().The line drag->exec(Qt::MoveAction); is not directing control to required dragenterevent(). may i know where problem is???
    Thanx a lot

    Regards
    Chirpylife

    Code:
    void test::mousePressEvent(QMouseEvent *event)
    	{
    
    	QPoint point = event->pos();
    	QPixmap pix;
    	int i = 1;
    	for (i = 1; i < 4; i++)
    		{
    		if (Rect[i].contains(point))
    			{
    			pix = pic1;
    			}
    		}
    
    	QByteArray itemData;
    	QDataStream dataStream(&itemData, QIODevice::WriteOnly);
    	int abc = 10;
    	dataStream << pix << abc;
    
    	QMimeData *mimeData = new QMimeData;
    	mimeData->setData("image", itemData);
    
    	QDrag *drag = new QDrag(this);
    	drag->setMimeData(mimeData);
    	drag->setHotSpot(event->pos() - Rect[i].topLeft());
    	drag->setPixmap(pix);
    	drag->exec(Qt::MoveAction);
    	
    }

    Code:
    void test::dragEnterEvent(QDragEnterEvent *event)
    	{
    	if (event->mimeData()->hasFormat("image"))
    		event->accept();
    	else
    		event->ignore();
    	}
    Last edited by chirpylife; 2010-03-26 at 06:11.

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    37

    Re: Drag issue

    Issue solved
    Thanx

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Drag issue

    Quote Originally Posted by chirpylife View Post
    Issue solved
    Thanx
    The solution could be interesting to other people facing the same problem in future.

Similar Threads

  1. Drag event problem
    By contra03 in forum Symbian
    Replies: 1
    Last Post: 2009-11-25, 05:38
  2. OVI Publishing Issue - POINT OF CONTACT
    By Vignesh.M in forum [Closed] Publishing to Nokia Store
    Replies: 4
    Last Post: 2009-08-18, 14:35
  3. Drag & Drop files into Nokia Phone Browser (File manager)
    By Flaxie2 in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2009-01-26, 06:10
  4. issue with at+cusd over bluetooth link
    By hbanks in forum General Messaging
    Replies: 2
    Last Post: 2007-09-25, 21:21
  5. RTSP video streaming issue on 6280
    By olivier_irac in forum General Development Questions
    Replies: 0
    Last Post: 2006-12-04, 15:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×