56 QHBoxLayout* layout =
new QHBoxLayout(
this);
57 this->setLayout(layout);
59 std::string path = getAssetPath();
60 QDir root(path.c_str());
63 model =
new QFileSystemModel(
this);
64 model->setRootPath(path.c_str());
65 model->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
66 model->sort(0, Qt::AscendingOrder);
84 filter <<
"*.png" <<
"*.jpg" <<
"*.bmp" <<
"*.obj" <<
"*.gltf" <<
"*.glb" <<
"*.fbx" <<
"*.STL" <<
"*.stl" <<
"*.xml";
86 listModel->setRootPath(path.c_str());
87 listModel->setFilter(QDir::Files | QDir::NoDotAndDotDot);
88 listModel->setNameFilters(filter);
89 listModel->setNameFilterDisables(
false);
90 listModel->sort(0, Qt::AscendingOrder);
94 listView->setViewMode(QListView::IconMode);
95 listView->setIconSize(QSize(80, 80));
96 listView->setGridSize(QSize(120, 120));
98 listView->setResizeMode(QListWidget::Adjust);
99 listView->setTextElideMode(Qt::ElideRight);
100 listView->setRootIndex(listModel->index(path.c_str()));
103 connect(
treeView, SIGNAL(clicked(
const QModelIndex&)),
106 connect(
listView, SIGNAL(clicked(
const QModelIndex&)),
109 connect(
listView, SIGNAL(doubleClicked(
const QModelIndex&)),
115 QString name =
model->fileName(index);
116 QString path =
model->fileInfo(index).absolutePath() +
"/" + name;
120 filter <<
"*.png" <<
"*.jpg" <<
"*.bmp" <<
"*.obj" <<
"*.gltf" <<
"*.glb" <<
"*.fbx" <<
"*.STL" <<
"*.stl" <<
"*.xml";
122 newListModel->setRootPath(path);
123 newListModel->setFilter(QDir::Files | QDir::NoDotAndDotDot);
124 newListModel->setNameFilters(filter);
125 newListModel->setNameFilterDisables(
false);
126 newListModel->sort(0, Qt::AscendingOrder);
129 listView->setRootIndex(newListModel->index(path));
void treeItemSelected(const QModelIndex &index)
void assetDoubleClicked(const QModelIndex &index)
void nodeCreated(std::shared_ptr< Node > node)
void assetItemSelected(const QModelIndex &index)
QContentBrowser(QWidget *parent=nullptr)