Commit 9c551f0c authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][dialogs] Implement input dialog for name requiring validation

parent 9b6fb6d0
......@@ -229,3 +229,33 @@ class AssetCreationDialog(QDialog, CreationType):
return True, dialog.creationType(), dialog.assetInfo()
else:
return False, None, None
class NameInputDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.name_lineedit = NameLineEdit()
self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
layout = QFormLayout(self)
layout.addRow(self.tr("Name"), self.name_lineedit)
layout.addWidget(self.buttonbox)
self.buttonbox.accepted.connect(self.accept)
self.buttonbox.rejected.connect(self.reject)
def name(self):
return self.name_lineedit.text()
@staticmethod
def getText(parent, title=""):
dialog = NameInputDialog(parent)
dialog.setWindowTitle(title)
result = dialog.exec_()
if result == QDialog.Accepted:
return dialog.name(), True
else:
return None, False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment