servatrice/cockatrice/src/gettextwithmax.h
ebbit1q 994704d353
implement max lengths for input dialogs that are sent to the server (#4522)
* implement max lengths for input dialogs that are sent to the server

* missed a double setMaxLength

* implement max string lengths server side

* add custom getText dialog with max length

* fix deck storage tab and miscellaneous server side

* add max size for deck uploads

* final pass on client side limits
2022-01-16 17:57:01 -05:00

23 lines
916 B
C

// custom QInputDialog::getText implementation that allows configuration of the max length
#ifndef GETTEXTWITHMAX_H
#define GETTEXTWITHMAX_H
#include "stringsizes.h"
#include <QInputDialog>
QString getTextWithMax(QWidget *parent,
const QString &title,
const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
const QString &text = QString(),
bool *ok = nullptr,
int max = MAX_NAME_LENGTH,
Qt::WindowFlags flags = Qt::WindowFlags(),
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
static inline QString getTextWithMax(QWidget *parent, const QString &title, const QString &label, int max)
{
return getTextWithMax(parent, title, label, QLineEdit::Normal, QString(), nullptr, max);
}
#endif // GETTEXTWITHMAX_H