From 2d3449251786371533b9e4a092a96e91b7d387c8 Mon Sep 17 00:00:00 2001 From: Maxim Stewart <1itdominator@gmail.com> Date: Sun, 18 Jun 2017 09:32:19 -0500 Subject: [PATCH] Implemented qtreeviewwidget instead of a list --- QtMeshViewer/Form Files/MainWindow.ui | 95 +- QtMeshViewer/Form Files/SettingsWindow.ui | 1102 ++++++++++----------- QtMeshViewer/Header/MainWindow.h | 3 +- QtMeshViewer/Source/MainWindow.cpp | 20 +- 4 files changed, 615 insertions(+), 605 deletions(-) diff --git a/QtMeshViewer/Form Files/MainWindow.ui b/QtMeshViewer/Form Files/MainWindow.ui index 6ea1c7d..227942b 100644 --- a/QtMeshViewer/Form Files/MainWindow.ui +++ b/QtMeshViewer/Form Files/MainWindow.ui @@ -4,16 +4,16 @@ - 0 - 0 - 800 - 600 + 0 + 0 + 800 + 600 - 600 - 400 + 600 + 400 @@ -24,63 +24,74 @@ - Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea + Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea - LeftToolBarArea + LeftToolBarArea - false + false - false + false - false + false - QDockWidget::DockWidgetFloatable + QDockWidget::DockWidgetFloatable - Qt::RightDockWidgetArea + Qt::RightDockWidgetArea - Asset library + Asset library - 2 + 2 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + Qt::ClickFocus + + + + + + + 0 + + + true + + + + + + diff --git a/QtMeshViewer/Form Files/SettingsWindow.ui b/QtMeshViewer/Form Files/SettingsWindow.ui index c8df29a..e8f0cd4 100644 --- a/QtMeshViewer/Form Files/SettingsWindow.ui +++ b/QtMeshViewer/Form Files/SettingsWindow.ui @@ -4,10 +4,10 @@ - 0 - 0 - 503 - 645 + 0 + 0 + 584 + 645 @@ -15,557 +15,557 @@ - - - Background - - - - - - false - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - B: - - - - - - - false - - - 255 - - - 5 - - - Qt::Horizontal - - - - - - - false - - - 255 - - - 5 - - - Qt::Horizontal - - - - - - - auto color - - - true - - - - - - - false - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - R: - - - - - - - G: - - - - - - - B: - - - - - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - 255 - - - 255 - - - Qt::Horizontal - - - - - - - true - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - 255 - - - 204 - - - Qt::Horizontal - - - - - - - 255 - - - 127 - - - Qt::Horizontal - - - - - - - Light on: - - - - - - - Light off: - - - - - - - R: - - - - - - - false - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - false - - - 255 - - - 5 - - - Qt::Horizontal - - - - - - - G: - - - - - + + + Background + + + + + + false + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + B: + + + + + + + false + + + 255 + + + 5 + + + Qt::Horizontal + + + + + + + false + + + 255 + + + 5 + + + Qt::Horizontal + + + + + + + auto color + + + true + + + + + + + false + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + R: + + + + + + + G: + + + + + + + B: + + + + + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + 255 + + + 255 + + + Qt::Horizontal + + + + + + + true + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + 255 + + + 204 + + + Qt::Horizontal + + + + + + + 255 + + + 127 + + + Qt::Horizontal + + + + + + + Light on: + + + + + + + Light off: + + + + + + + R: + + + + + + + false + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + false + + + 255 + + + 5 + + + Qt::Horizontal + + + + + + + G: + + + + + - - - Light - - - - - - Ambientcoefficient: - - - - - - - 255 - - - 255 - - - Qt::Horizontal - - - - - - - true - - - - 55 - 16777215 - - - - 3 - - - 1.000000000000000 - - - 0.001000000000000 - - - 0.005000000000000 - - - - - - - false - - - - 55 - 16777215 - - - - 1 - - - 0.100000000000000 - - - - - - - R: - - - - - - - Directional light - - - true - - - - - - - 255 - - - 255 - - - Qt::Horizontal - - - - - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - Point light - - - - - - - 255 - - - 255 - - - Qt::Horizontal - - - - - - - G: - - - - - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - Attenuationfactor: - - - - - - - B: - - - - - - - - 30 - 16777215 - - - - QAbstractSpinBox::NoButtons - - - 255 - - - - - - - Headlight - - - - - + + + Light + + + + + + Ambientcoefficient: + + + + + + + 255 + + + 255 + + + Qt::Horizontal + + + + + + + true + + + + 55 + 16777215 + + + + 3 + + + 1.000000000000000 + + + 0.001000000000000 + + + 0.005000000000000 + + + + + + + false + + + + 55 + 16777215 + + + + 1 + + + 0.100000000000000 + + + + + + + R: + + + + + + + Directional light + + + true + + + + + + + 255 + + + 255 + + + Qt::Horizontal + + + + + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + Point light + + + + + + + 255 + + + 255 + + + Qt::Horizontal + + + + + + + G: + + + + + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + Attenuationfactor: + + + + + + + B: + + + + + + + + 30 + 16777215 + + + + QAbstractSpinBox::NoButtons + + + 255 + + + + + + + Headlight + + + + + - - - General - - - - - - Backface Culling - - - - - - - Zoom speed: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - % - - - 200 - - - 10 - - - 100 - - - - - - - Directory Drop Down List: - - - - - - - - - - *** "BF1_ModTools" Goes To "C:/BF1_ModTools/Assets/Shipped Worlds/" - "BF2_ModTools" Goes To "C:/BF2_ModTools/assets/Sides/" - - - - - - - -- - - - - - - - + - - - - - + + + General + + + + + + Backface Culling + + + + + + + Zoom speed: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + % + + + 200 + + + 10 + + + 100 + + + + + + + Directory Drop Down List: + + + + + + + + + + *** "BF1_ModTools" Goes To "C:/BF1_ModTools/Assets/Shipped Worlds/" + "BF2_ModTools" Goes To "C:/BF2_ModTools/assets/Sides/" + + + + + + + -- + + + + + + + + + + + + + diff --git a/QtMeshViewer/Header/MainWindow.h b/QtMeshViewer/Header/MainWindow.h index 25b4312..0c911a3 100644 --- a/QtMeshViewer/Header/MainWindow.h +++ b/QtMeshViewer/Header/MainWindow.h @@ -26,7 +26,6 @@ private: FileInfoWindow* m_infoWindow; QStringList m_filters; - QStringList m_Paths; // functions private: @@ -52,6 +51,6 @@ signals: // private slots private slots: - void on_fileListWidget_doubleClicked(const QModelIndex &index); + void on_fileTreeWidget_doubleClicked(); void on_dirDropDownList_currentTextChanged(const QString &arg1); }; diff --git a/QtMeshViewer/Source/MainWindow.cpp b/QtMeshViewer/Source/MainWindow.cpp index f8d9d22..48b531b 100644 --- a/QtMeshViewer/Source/MainWindow.cpp +++ b/QtMeshViewer/Source/MainWindow.cpp @@ -13,7 +13,7 @@ #include #include #include - +#include #define WINDOW_NAME "Mesh Viewer" @@ -68,6 +68,7 @@ MainWindow::~MainWindow() delete m_infoWindow; } + ///////////////////////////////////////////////////////////////////////// // functions void MainWindow::setupWidgets() @@ -181,15 +182,15 @@ void MainWindow::setupAssetLibrary() void MainWindow::updateAssetTree(QString path) { - ui->fileListWidget->clear(); - m_Paths.clear(); - QDirIterator itterator(path, QStringList() << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH", + ui->fileTreeWidget->clear(); + QDirIterator itterator(path, QStringList() << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH", QDir::Files, QDirIterator::Subdirectories); while (itterator.hasNext()) { - ui->fileListWidget->insertItem(0, new QListWidgetItem(itterator.fileName())); - m_Paths.prepend(itterator.fileInfo().absoluteFilePath()); - itterator.next(); + QTreeWidgetItem* sub = new QTreeWidgetItem(ui->fileTreeWidget); + sub->setData(0, Qt::DisplayRole, itterator.fileName()); + sub->setData(1, Qt::DisplayRole, itterator.fileInfo().absoluteFilePath()); + itterator.next(); } } @@ -242,10 +243,9 @@ void MainWindow::resizeEvent(QResizeEvent * e) ///////////////////////////////////////////////////////////////////////// // slots -void MainWindow::on_fileListWidget_doubleClicked(const QModelIndex &index) +void MainWindow::on_fileTreeWidget_doubleClicked() { - int slotVal = index.row(); - QString clickedFile = m_Paths.at(slotVal); + QString clickedFile = ui->fileTreeWidget->currentItem()->text(1); openFile(clickedFile); }