1
0
Эх сурвалжийг харах

Fixes #18 Add a remove button in the open dialog

isundil 7 сар өмнө
parent
commit
76ebcc40e5

+ 12 - 4
fakeRaid/browseModal.cpp

@@ -44,10 +44,18 @@ QWidget* BrowseModal::CreateBrowseInput(const char* text)
 	QHBoxLayout* horizontalLayout_2 = new QHBoxLayout(groupBox);
 	QLineEdit* lineEdit = new QLineEdit(groupBox);
 	horizontalLayout_2->addWidget(lineEdit);
-	QPushButton* pushButton = new QPushButton(groupBox);
-	pushButton->setText(QCoreApplication::translate("BrowseModal", "Parcourir", nullptr));
-	horizontalLayout_2->addWidget(pushButton);
-	InitializeBrowseInput(groupBox, lineEdit, pushButton, text);
+	QPushButton* browseButton = new QPushButton(groupBox);
+	browseButton->setText(QCoreApplication::translate("BrowseModal", "Parcourir", nullptr));
+	horizontalLayout_2->addWidget(browseButton);
+	QPushButton* removeButton = new QPushButton(groupBox);
+	removeButton->setText(QCoreApplication::translate("BrowseModal", "Retirer", nullptr));
+	horizontalLayout_2->addWidget(removeButton);
+	connect(removeButton, &QAbstractButton::clicked, this, [this, lineEdit, groupBox]()
+		{
+			groupBox->deleteLater();
+			inputs.remove(lineEdit);
+		});
+	InitializeBrowseInput(groupBox, lineEdit, browseButton, text);
 	return groupBox;
 }
 

+ 1 - 1
fakeRaid/browseModal.h

@@ -32,7 +32,7 @@ namespace craftlab::fakeraid
 
 		bool rejected = false;
 		bool cancellable;
-		std::vector<QLineEdit*> inputs;
+		std::list<QLineEdit*> inputs;
 		std::unique_ptr<Ui_BrowseModal> ui;
 	};
 }