mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-12 01:06:46 -04:00
frontend: Remove unused item delegate parameters
This commit is contained in:
@@ -350,6 +350,10 @@
|
||||
qproperty-icon: url(theme:Dark/save.svg);
|
||||
}
|
||||
|
||||
.icon-close {
|
||||
qproperty-icon: url(theme:Dark/close.svg);
|
||||
}
|
||||
|
||||
/* Media icons */
|
||||
|
||||
.icon-media-play {
|
||||
|
||||
@@ -118,6 +118,10 @@ QPushButton#sourceFiltersButton {
|
||||
qproperty-icon: url(theme:Light/revert.svg);
|
||||
}
|
||||
|
||||
.icon-close {
|
||||
qproperty-icon: url(theme:Light/close.svg);
|
||||
}
|
||||
|
||||
QToolBarExtension {
|
||||
qproperty-icon: url(theme:Light/dots-vert.svg);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ OBSMissingFiles::OBSMissingFiles(obs_missing_files_t *files, QWidget *parent)
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableView->setModel(filesModel);
|
||||
ui->tableView->setItemDelegateForColumn(MissingFilesColumn::NewPath,
|
||||
new MissingFilesPathItemDelegate(true, ""));
|
||||
ui->tableView->setItemDelegateForColumn(MissingFilesColumn::NewPath, new MissingFilesPathItemDelegate());
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents);
|
||||
ui->tableView->horizontalHeader()->setMaximumSectionSize(width() / 4);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(MissingFilesColumn::NewPath,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -23,7 +23,7 @@ class MissingFilesPathItemDelegate : public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MissingFilesPathItemDelegate(bool isOutput, const QString &defaultPath);
|
||||
MissingFilesPathItemDelegate();
|
||||
|
||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */,
|
||||
const QModelIndex &index) const override;
|
||||
@@ -37,8 +37,6 @@ protected:
|
||||
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
bool isOutput;
|
||||
QString defaultPath;
|
||||
const char *PATH_LIST_PROP = "pathList";
|
||||
|
||||
void handleBrowse(QWidget *container);
|
||||
|
||||
Reference in New Issue
Block a user