Accessing Image gallery of a mobile phone and view images...
-
Some hint about which phones you want to target would be helpful...
-
hi gerolf, i have tried something...
you please check it out@
void Dialog::searchImagesFromDir(QString path)
{
// imageIndex = 0;QDir dir; dir.setFilter(QDir::Files | QDir::Dirs); dir.setPath(path); QString paths = "the available images are"; QFileInfoList list = dir.entryInfoList(); for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); if (fileInfo.isFile()) { QString s = fileInfo.filePath(); paths += s + "a"; if (s.indexOf(QString(".png"), 0, Qt::CaseInsensitive) > 0) { imageList.append(s); } } else { QString s = fileInfo.filePath(); paths += s + "b"; if (!s.contains(".") && !s.contains("..")) searchImagesFromDir(fileInfo.filePath()); } } ui->lblImages->setText(paths);
}
@EDIT: Please only use one @ tag at beginning and one at end of code, gerolf
-
And...? Did you succeed? If not, what problems did you encounter?
Perhaps a simpeler solution would be to use QFileSystemModel, and set a filter on image types. If you know where your images are on the file system, that should be an easy solution.
Also, note that there are many demo's displaying images from a path on the system or even from an online service available online. You way want to let those inspire you.
-
Hi,
What about the QtMobility.gallery 1.1I have tried this example code below from Mobility reference documentation but no error and no expected output either. Have anybody any idea that how does this gallery library can be used successfully in N900 or MeeGo for example.
Note: I was trying also to access any image metaData (e.g date, time etc.) but did not find any QML/Qt based API that helps to get it. Anybody any idea?
Code:
import Qt 4.7
import QtMobility.gallery 1.1Rectangle {
height: 854; width: 480
color: "white"GridView { anchors.fill: parent cellWidth: 128 cellHeight: 128 model: DocumentGalleryModel { rootType: DocumentGallery.Image properties: [ "url" ] filter: GalleryWildcardFilter { property: "fileName"; value: "*.jpg"; } } delegate: Image { source: url width: 128 height: 128 } }
}