hello.
i look at the example "imagescaling" 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
}
class ImageData
{
//... some data for the image size and path
}
class MyImage: public QWidget, public ImageData
{
// some function for working with images
}
To copy to clipboard, switch view to plain text mode
Then I have another class for working with all loaded images.
imagelist.h
{
//...
}
class MyLsit:public QWidget
{
//...
}
To copy to clipboard, switch view to plain text mode
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
}
// 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
}
To copy to clipboard, switch view to plain text mode
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
){...
}
QImage loadImage(const ImageData &data){...}
To copy to clipboard, switch view to plain text mode
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!
Bookmarks