|
|
@@ -28,12 +28,7 @@
|
|
|
|
|
|
enum MissingFilesRole { EntryStateRole = Qt::UserRole, NewPathsToProcessRole };
|
|
|
|
|
|
-MissingFilesPathItemDelegate::MissingFilesPathItemDelegate(bool isOutput, const QString &defaultPath)
|
|
|
- : QStyledItemDelegate(),
|
|
|
- isOutput(isOutput),
|
|
|
- defaultPath(defaultPath)
|
|
|
-{
|
|
|
-}
|
|
|
+MissingFilesPathItemDelegate::MissingFilesPathItemDelegate() : QStyledItemDelegate() {}
|
|
|
|
|
|
QWidget *MissingFilesPathItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */,
|
|
|
const QModelIndex &) const
|
|
|
@@ -68,15 +63,15 @@ QWidget *MissingFilesPathItemDelegate::createEditor(QWidget *parent, const QStyl
|
|
|
|
|
|
container->connect(browseButton, &QToolButton::clicked, browseCallback);
|
|
|
|
|
|
- // The "clear" button is not shown in input cells
|
|
|
- if (isOutput) {
|
|
|
- QToolButton *clearButton = new QToolButton();
|
|
|
- clearButton->setText("X");
|
|
|
- clearButton->setSizePolicy(buttonSizePolicy);
|
|
|
- layout->addWidget(clearButton);
|
|
|
+ QToolButton *clearButton = new QToolButton();
|
|
|
+ QIcon icon;
|
|
|
+ icon.addFile(QString::fromUtf8(":/res/images/close.svg"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
|
|
|
+ clearButton->setIcon(icon);
|
|
|
+ clearButton->setProperty("class", "icon-close");
|
|
|
+ clearButton->setSizePolicy(buttonSizePolicy);
|
|
|
+ layout->addWidget(clearButton);
|
|
|
|
|
|
- container->connect(clearButton, &QToolButton::clicked, clearCallback);
|
|
|
- }
|
|
|
+ container->connect(clearButton, &QToolButton::clicked, clearCallback);
|
|
|
|
|
|
container->setLayout(layout);
|
|
|
container->setFocusProxy(text);
|
|
|
@@ -105,10 +100,7 @@ void MissingFilesPathItemDelegate::setModelData(QWidget *editor, QAbstractItemMo
|
|
|
QVariant pathListProp = editor->property(PATH_LIST_PROP);
|
|
|
if (pathListProp.isValid()) {
|
|
|
QStringList list = editor->property(PATH_LIST_PROP).toStringList();
|
|
|
- if (isOutput) {
|
|
|
- model->setData(index, list);
|
|
|
- } else
|
|
|
- model->setData(index, list, MissingFilesRole::NewPathsToProcessRole);
|
|
|
+ model->setData(index, list);
|
|
|
} else {
|
|
|
QLineEdit *lineEdit = editor->findChild<QLineEdit *>();
|
|
|
model->setData(index, lineEdit->text(), 0);
|
|
|
@@ -137,22 +129,21 @@ void MissingFilesPathItemDelegate::handleBrowse(QWidget *container)
|
|
|
|
|
|
QString currentPath = text->text();
|
|
|
if (currentPath.isEmpty() || currentPath.compare(QTStr("MissingFiles.Clear")) == 0)
|
|
|
- currentPath = defaultPath;
|
|
|
+ currentPath = "";
|
|
|
|
|
|
bool isSet = false;
|
|
|
- if (isOutput) {
|
|
|
- QString newPath =
|
|
|
- QFileDialog::getOpenFileName(container, QTStr("MissingFiles.SelectFile"), currentPath, nullptr);
|
|
|
+
|
|
|
+ QString newPath =
|
|
|
+ QFileDialog::getOpenFileName(container, QTStr("MissingFiles.SelectFile"), currentPath, nullptr);
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
- // TODO: Revisit when QTBUG-42661 is fixed
|
|
|
- container->window()->raise();
|
|
|
+ // TODO: Revisit when QTBUG-42661 is fixed
|
|
|
+ container->window()->raise();
|
|
|
#endif
|
|
|
|
|
|
- if (!newPath.isEmpty()) {
|
|
|
- container->setProperty(PATH_LIST_PROP, QStringList() << newPath);
|
|
|
- isSet = true;
|
|
|
- }
|
|
|
+ if (!newPath.isEmpty()) {
|
|
|
+ container->setProperty(PATH_LIST_PROP, QStringList() << newPath);
|
|
|
+ isSet = true;
|
|
|
}
|
|
|
|
|
|
if (isSet)
|