Implemented qtreeviewwidget instead of a list
This commit is contained in:
parent
3f2713bd16
commit
2d34492517
|
@ -73,10 +73,21 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="dirDropDownList"/>
|
<widget class="QComboBox" name="dirDropDownList">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::ClickFocus</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="fileListWidget"/>
|
<widget class="QTreeWidget" name="fileTreeWidget">
|
||||||
|
<property name="autoExpandDelay">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="headerHidden">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>503</width>
|
<width>584</width>
|
||||||
<height>645</height>
|
<height>645</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -26,7 +26,6 @@ private:
|
||||||
|
|
||||||
FileInfoWindow* m_infoWindow;
|
FileInfoWindow* m_infoWindow;
|
||||||
QStringList m_filters;
|
QStringList m_filters;
|
||||||
QStringList m_Paths;
|
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
private:
|
private:
|
||||||
|
@ -52,6 +51,6 @@ signals:
|
||||||
|
|
||||||
// private slots
|
// private slots
|
||||||
private slots:
|
private slots:
|
||||||
void on_fileListWidget_doubleClicked(const QModelIndex &index);
|
void on_fileTreeWidget_doubleClicked();
|
||||||
void on_dirDropDownList_currentTextChanged(const QString &arg1);
|
void on_dirDropDownList_currentTextChanged(const QString &arg1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QTreeWidgetItem>
|
||||||
|
|
||||||
#define WINDOW_NAME "Mesh Viewer"
|
#define WINDOW_NAME "Mesh Viewer"
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ MainWindow::~MainWindow()
|
||||||
delete m_infoWindow;
|
delete m_infoWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// functions
|
// functions
|
||||||
void MainWindow::setupWidgets()
|
void MainWindow::setupWidgets()
|
||||||
|
@ -181,14 +182,14 @@ void MainWindow::setupAssetLibrary()
|
||||||
|
|
||||||
void MainWindow::updateAssetTree(QString path)
|
void MainWindow::updateAssetTree(QString path)
|
||||||
{
|
{
|
||||||
ui->fileListWidget->clear();
|
ui->fileTreeWidget->clear();
|
||||||
m_Paths.clear();
|
|
||||||
QDirIterator itterator(path, QStringList() << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH",
|
QDirIterator itterator(path, QStringList() << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH",
|
||||||
QDir::Files, QDirIterator::Subdirectories);
|
QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
while (itterator.hasNext()) {
|
while (itterator.hasNext()) {
|
||||||
ui->fileListWidget->insertItem(0, new QListWidgetItem(itterator.fileName()));
|
QTreeWidgetItem* sub = new QTreeWidgetItem(ui->fileTreeWidget);
|
||||||
m_Paths.prepend(itterator.fileInfo().absoluteFilePath());
|
sub->setData(0, Qt::DisplayRole, itterator.fileName());
|
||||||
|
sub->setData(1, Qt::DisplayRole, itterator.fileInfo().absoluteFilePath());
|
||||||
itterator.next();
|
itterator.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,10 +243,9 @@ void MainWindow::resizeEvent(QResizeEvent * e)
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// slots
|
// slots
|
||||||
|
|
||||||
void MainWindow::on_fileListWidget_doubleClicked(const QModelIndex &index)
|
void MainWindow::on_fileTreeWidget_doubleClicked()
|
||||||
{
|
{
|
||||||
int slotVal = index.row();
|
QString clickedFile = ui->fileTreeWidget->currentItem()->text(1);
|
||||||
QString clickedFile = m_Paths.at(slotVal);
|
|
||||||
openFile(clickedFile);
|
openFile(clickedFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue