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:
static void addStuff
( QWidget * parent,
bool image,
bool secret
= FALSE ) {
if(image)
{
drag *drg = new drag(parent);
drag *drg1 = new drag(parent);
tll->addWidget( drg );
tll->addWidget( drg1 );
if(stuff.load( "trolltech.bmp" )); ----i think this caused my image not to be moved---
itemname[0]=1;
stuff1.load( "butterfly.png" );
drg->setPixmap( stuff );
drg1->setPixmap( stuff1 );
}
else
{
drop *drp= new drop(parent);
drop *drp1= new drop(parent);
tll->addWidget( drp );
tll->addWidget( drp1 );
drp->setText("Drop the items");
drp
->setFont
(QFont("Helvetica",
12));
drp1->setText("Drag and Drop");
drp1
->setFont
(QFont("Helvetica",
12));
}
}
static void addStuff( QWidget * parent, bool image, bool secret = FALSE )
{
QVBoxLayout * tll = new QVBoxLayout( parent);
if(image)
{
drag *drg = new drag(parent);
drag *drg1 = new drag(parent);
tll->addWidget( drg );
tll->addWidget( drg1 );
QPixmap stuff;
QPixmap stuff1;
if(stuff.load( "trolltech.bmp" )); ----i think this caused my image not to be moved---
itemname[0]=1;
stuff1.load( "butterfly.png" );
drg->setPixmap( stuff );
drg1->setPixmap( stuff1 );
}
else
{
drop *drp= new drop(parent);
drop *drp1= new drop(parent);
tll->addWidget( drp );
tll->addWidget( drp1 );
drp->setText("Drop the items");
drp->setFont(QFont("Helvetica",12));
drp1->setText("Drag and Drop");
drp1->setFont(QFont("Helvetica",12));
}
}
To copy to clipboard, switch view to plain text mode
.
thinking of using QIconview. any suggestions ?
Bookmarks