What should i do with that ?!
#include "controller.h"
#include <QDir>
#include "controller.h"
#include <QDir>
Controller::Controller(QObject *parent) :
QObject(parent)
Controller::Controller(QObject *parent) :
QObject(parent)
+QStringList Controller::getImages(const QString &path) const{
+ QDir dir(path);
+ QStringList filters;
+ filters << "*.png" << "*.jpg" << "*.jpeg";
+ dir.setNameFilters(filters);
+
+ QStringList m_images;
+
+ dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
+ dir.setSorting(QDir::Size | QDir::Reversed);
+ QFileInfoList list = dir.entryInfoList();
+ for (int i = 0; i < list.size(); ++i) {
+ QFileInfo fileInfo = list.at(i);
+ m_images.append(fileInfo.absoluteFilePath());
+ }
+
+ return m_images;
+}
#define CONTROLLER_H
#include <QObject>
#define CONTROLLER_H
#include <QObject>
class Controller : public QObject
{
Q_OBJECT
class Controller : public QObject
{
Q_OBJECT
public:
explicit Controller(QObject *parent = 0);
public:
explicit Controller(QObject *parent = 0);
public slots:
bool pathExists(const QString &path);
public slots:
bool pathExists(const QString &path);
+ QStringList getImages(const QString &path) const;
};
#endif // CONTROLLER_H
};
#endif // CONTROLLER_H
visible: true
opacity:0.9
color:"white"
visible: true
opacity:0.9
color:"white"
+
+ ListModel{
+ id:img
+
+ function list(){
+ while(img.count>0) img.remove(img.count-1);
+ var limg = Controller.getImages("/home/cuongle");
+ for (var i=0;i<limg.length;i++)
+ append({name:limg[i]})
+ }
+ }
+
+ GridView {
+ anchors.fill: parent;anchors.topMargin: 35;anchors.leftMargin: 5;anchors.rightMargin: 5;anchors.bottomMargin: 12
+ model: img
+ delegate: Column {
+ Image { source: "file:"+name; anchors.horizontalCenter: parent.horizontalCenter; width:100;height:100; }
+ Text { text: "-"; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+ }
+
+
}
ToolBar { id: toolBar; height: 50;
}
ToolBar { id: toolBar; height: 50;
+function refresh(){
+ img.list();
+}
+
ListElement {
idm:5; name: "Xem Theo Tháng";title:"Xem ngày Dương Lịch/Âm Lịch dưới dạng tháng"
}
ListElement {
idm:5; name: "Xem Theo Tháng";title:"Xem ngày Dương Lịch/Âm Lịch dưới dạng tháng"
}
idm:7; name: "Đổi Theme";title:"Thay đổi theme, hình nền, ..."
}
ListElement {
idm:8; name: "Đổi Hình Nền";title:"/opt/bar/load.jpg"
idm:7; name: "Đổi Theme";title:"Thay đổi theme, hình nền, ..."
}
ListElement {
idm:8; name: "Đổi Hình Nền";title:"/opt/bar/load.jpg"
ListElement {
idm:6; name: "Giới Thiệu";title:"..."
}
ListElement {
idm:6; name: "Giới Thiệu";title:"..."
}
PropertyChanges { target: fileBrowser; x: 0; focus:true; visible:true;}
PropertyChanges { target: toolBar; y: screen.height }
PropertyChanges { target: toolBar }
PropertyChanges { target: fileBrowser; x: 0; focus:true; visible:true;}
PropertyChanges { target: toolBar; y: screen.height }
PropertyChanges { target: toolBar }
+ StateChangeScript {
+ script:{
+ fileBrowser.refresh();
+ }
+ }
},
State {
name: "optionsscreen";
},
State {
name: "optionsscreen";