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>
</property>
<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">
<widget class="QLabel" name="label">
<property name="text">
@ -556,6 +553,9 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QListWidget" name="dirListWidget"/>
</item>
</layout>
</widget>
</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)));
}

View File

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