Modal dialog asking for the name and parent zone of a new custom deck zone.
More...
#include <deck_zone_dialog.h>
|
| | DeckZoneDialog (QWidget *parent=nullptr, const QString &initialBoardName={}, const std::function< QString(const QString &)> &_nameValidator={}, bool _allowBoardSelection=true) |
| | Constructs the dialog and runs the initial validation pass.
|
| QString | getZoneName () const |
| | The trimmed zone name entered by the user.
|
| QString | getBoardName () const |
| | The internal name of the board zone selected in the combo.
|
| void | setZoneName (const QString &zoneName) |
| | Prefills the name field, e.g. with the current name when renaming.
|
|
| static QString | promptForNewZone (QWidget *parent, const QString &initialBoardName, QString *chosenBoardName, const std::function< QString(const QString &)> &nameValidator={}) |
| | Prompts the user for a new custom zone name and the board zone to nest it under.
|
| static QString | promptForRename (QWidget *parent, const QString ¤tZoneName, const std::function< QString(const QString &)> &nameValidator={}) |
| | Prompts the user for a new name for an existing custom zone.
|
|
| void | retranslateUi () |
| | Sets every user-visible string. Runs on construction and on runtime language changes.
|
| void | validateName () |
| | Validates the current input, toggling Ok and the inline error label.
|
Modal dialog asking for the name and parent zone of a new custom deck zone.
Menus construct the dialog transiently around exec(), so validation state only ever reflects the name currently typed.
◆ DeckZoneDialog()
| DeckZoneDialog::DeckZoneDialog |
( |
QWidget * | parent = nullptr, |
|
|
const QString & | initialBoardName = {}, |
|
|
const std::function< QString(const QString &)> & | _nameValidator = {}, |
|
|
bool | _allowBoardSelection = true ) |
|
explicit |
Constructs the dialog and runs the initial validation pass.
- Parameters
-
| parent | The parent widget for the dialog |
| initialBoardName | The board zone to preselect in the combo. Unknown names fall back to main. |
| _nameValidator | Given the trimmed candidate name, returns an empty string when it is usable, otherwise a user-facing error message. May be empty. |
| _allowBoardSelection | When false the parent-zone combo is hidden and the dialog acts as a rename prompt for an existing zone. |
◆ changeEvent()
| void DeckZoneDialog::changeEvent |
( |
QEvent * | event | ) |
|
|
overrideprotected |
◆ getBoardName()
| QString DeckZoneDialog::getBoardName |
( |
| ) |
const |
|
nodiscard |
The internal name of the board zone selected in the combo.
◆ getZoneName()
| QString DeckZoneDialog::getZoneName |
( |
| ) |
const |
|
nodiscard |
The trimmed zone name entered by the user.
◆ promptForNewZone()
| QString DeckZoneDialog::promptForNewZone |
( |
QWidget * | parent, |
|
|
const QString & | initialBoardName, |
|
|
QString * | chosenBoardName, |
|
|
const std::function< QString(const QString &)> & | nameValidator = {} ) |
|
static |
Prompts the user for a new custom zone name and the board zone to nest it under.
Convenience wrapper that runs DeckZoneDialog modally.
- Parameters
-
| parent | The parent widget for the dialog |
| initialBoardName | The board zone to preselect in the dialog. Unknown names fall back to main. |
| chosenBoardName | (out) The internal name of the board zone the user chose |
| nameValidator | Optional validator forwarded to the dialog |
- Returns
- The trimmed zone name, or an empty string if the user cancelled
◆ promptForRename()
| QString DeckZoneDialog::promptForRename |
( |
QWidget * | parent, |
|
|
const QString & | currentZoneName, |
|
|
const std::function< QString(const QString &)> & | nameValidator = {} ) |
|
static |
Prompts the user for a new name for an existing custom zone.
Same inline validation as promptForNewZone, but without a parent-zone picker.
- Parameters
-
| parent | The parent widget for the dialog |
| currentZoneName | The current name, prefilled for editing |
| nameValidator | Validator deciding whether a candidate name is usable. It sees the current name too, so callers wanting to allow unchanged names must special-case that themselves. |
- Returns
- The trimmed new name, or an empty string if the user cancelled
◆ retranslateUi()
| void DeckZoneDialog::retranslateUi |
( |
| ) |
|
|
private |
Sets every user-visible string. Runs on construction and on runtime language changes.
◆ setZoneName()
| void DeckZoneDialog::setZoneName |
( |
const QString & | zoneName | ) |
|
Prefills the name field, e.g. with the current name when renaming.
- Parameters
-
| zoneName | The text to put into the name field, selected for quick editing |
◆ validateName()
| void DeckZoneDialog::validateName |
( |
| ) |
|
|
private |
Validates the current input, toggling Ok and the inline error label.
◆ allowBoardSelection
| bool DeckZoneDialog::allowBoardSelection |
|
private |
◆ boardCombo
| QComboBox* DeckZoneDialog::boardCombo |
|
private |
◆ boardLabel
| QLabel* DeckZoneDialog::boardLabel |
|
private |
◆ buttonBox
| QDialogButtonBox* DeckZoneDialog::buttonBox |
|
private |
◆ errorLabel
| QLabel* DeckZoneDialog::errorLabel |
|
private |
◆ nameEdit
| QLineEdit* DeckZoneDialog::nameEdit |
|
private |
◆ nameLabel
| QLabel* DeckZoneDialog::nameLabel |
|
private |
◆ nameValidator
| std::function<QString(const QString &)> DeckZoneDialog::nameValidator |
|
private |
The documentation for this class was generated from the following files: