Added add and remove functionality to settings listWidget

This commit is contained in:
Maxim Stewart 2017-06-15 22:31:11 -05:00
parent bddc7ea852
commit d908894265
3 changed files with 8 additions and 7 deletions

View File

@ -489,9 +489,6 @@
<string>General</string> <string>General</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_4">
<item row="3" column="1" colspan="3">
<widget class="QListView" name="dirListView"/>
</item>
<item row="2" column="1" colspan="3"> <item row="2" column="1" colspan="3">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -556,6 +553,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" colspan="3">
<widget class="QListWidget" name="dirListWidget"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -410,3 +410,4 @@ void MainWindow::setFileInfo(QString name, QVector<Material>* materials, int ver
m_infoWindow->setDetailText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8))); m_infoWindow->setDetailText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8)));
} }

View File

@ -1,6 +1,8 @@
#include "..\Header\SettingsWindow.h" #include "..\Header\SettingsWindow.h"
#include "..\Header\SettingsManager.h" #include "..\Header\SettingsManager.h"
#include <QFileDialog> #include <QFileDialog>
#include <QListWidgetItem>
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// constructor/destructor // constructor/destructor
@ -195,12 +197,10 @@ void SettingsWindow::on_addItem_clicked()
QString dirName = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QString dirName = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home",
QFileDialog::ShowDirsOnly | QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks); QFileDialog::DontResolveSymlinks);
// ui->dirListView-> selectionModel()-> ui->dirListWidget->insertItem(0,dirName);
// ui->dirListView->model()->insertRow(dirName) ; //->insertRow(dirName);
} }
void SettingsWindow::on_removeItem_clicked() void SettingsWindow::on_removeItem_clicked()
{ {
ui->dirListView->selectionModel()->selectedIndexes(); qDeleteAll(ui->dirListWidget->selectedItems());
// ui->dirListView->model()->removeRow(ui->dirListView->selectionModel()->selectedIndexes());
} }