codebehind
11th September 2009, 13:32
hello.
i look at the example "imagescaling" (http://doc.trolltech.com/4.4/qtconcurrent-imagescaling.html) and done some upgrade.
well:
image.h (image.cpp has all the implementation)
class ImageData
{
//... some data for the image size and path
}
class MyImage: public QWidget, public ImageData
{
// some function for working with images
}
Then I have another class for working with all loaded images.
imagelist.h
class MyLsit:public QWidget
{
//...
}
imageList.cpp
// my function for loading image
MyImage loadImage(const ImageData &data)
{
MyImage m;
//... things to do on loading images
return m;
}
void MyList::FirstStep()
{
QList<ImageData> datalist;
// load data
collection= new QFutureWatcher<Image>((QObject*)this);
collection->setFuture(QtConcurrent::mapped(datalist,loadImage) );
// etc
}
when I compile the project it returns the error:
/usr/lib64/qt-4.4.1/include/QtGui/qwidget.h: In copy constructor ‘MyImage::MyImage(const MyImage&)’:
/usr/lib64/qt-4.4.1/include/QtGui/qwidget.h:750: error: ‘QWidget::QWidget(const QWidget&)’ is private
../qt4/Tools/ShowImg/image.h:18: error: within this context
../qt4/Tools/imgsched.cpp: In function ‘Image LoadImage(ImageData&)’:
../qt4/Tools/imgsched.cpp:12: note: synthesized method ‘MyImage::MyImage(const MyImage&)’ first required here
if I change MyImage with QImage:
QImage loadImage(const ImageData &data){...}
it compiles.
I think this is an C++ feature, but i can not work it out.
Any suggestion on how to implement this would be appreciate.
thx!
i look at the example "imagescaling" (http://doc.trolltech.com/4.4/qtconcurrent-imagescaling.html) and done some upgrade.
well:
image.h (image.cpp has all the implementation)
class ImageData
{
//... some data for the image size and path
}
class MyImage: public QWidget, public ImageData
{
// some function for working with images
}
Then I have another class for working with all loaded images.
imagelist.h
class MyLsit:public QWidget
{
//...
}
imageList.cpp
// my function for loading image
MyImage loadImage(const ImageData &data)
{
MyImage m;
//... things to do on loading images
return m;
}
void MyList::FirstStep()
{
QList<ImageData> datalist;
// load data
collection= new QFutureWatcher<Image>((QObject*)this);
collection->setFuture(QtConcurrent::mapped(datalist,loadImage) );
// etc
}
when I compile the project it returns the error:
/usr/lib64/qt-4.4.1/include/QtGui/qwidget.h: In copy constructor ‘MyImage::MyImage(const MyImage&)’:
/usr/lib64/qt-4.4.1/include/QtGui/qwidget.h:750: error: ‘QWidget::QWidget(const QWidget&)’ is private
../qt4/Tools/ShowImg/image.h:18: error: within this context
../qt4/Tools/imgsched.cpp: In function ‘Image LoadImage(ImageData&)’:
../qt4/Tools/imgsched.cpp:12: note: synthesized method ‘MyImage::MyImage(const MyImage&)’ first required here
if I change MyImage with QImage:
QImage loadImage(const ImageData &data){...}
it compiles.
I think this is an C++ feature, but i can not work it out.
Any suggestion on how to implement this would be appreciate.
thx!