Go to the documentation of this file.
11 #include <QCoreApplication>
12 #include <QDomDocument>
28 if ((high == low) || step == 0)
45 while ((reverse && (value >= high)) ||
46 (!reverse && (value <= high)))
63 if (temp.contains(
"%n"))
65 text = QCoreApplication::translate(
"ThemeUI", temp.toUtf8(),
nullptr,
70 text = QCoreApplication::translate(
"ThemeUI", temp.toUtf8());
76 text = QString::number(value);
110 for (
int pos = 0; pos <
m_itemList.size(); pos++)
113 if (item->
GetData().toInt() > value)
121 QVariant::fromValue(value), insertPos);
128 const QString &
filename, QDomElement &element,
bool showWarnings)
130 if (element.tagName() ==
"template")
134 if (element.attribute(
"type") ==
"negative")
136 else if (element.attribute(
"type") ==
"zero")
156 bool handled =
false;
171 bool handled =
false;
187 spinbox->CopyFrom(
this);
218 bool handled =
false;
227 QString initialEntry = item->
GetText();
228 bool doEntry =
false;
231 bool isNumber =
false;
232 (void)initialEntry.toLongLong(&isNumber,10);
236 for (
const QString&
action : std::as_const(actions))
251 if (actions.empty() && event->text() ==
"-")
286 int low,
int high,
int step)
288 m_parentList(parentList),
289 m_searchText(std::move(searchText)),
290 m_selection(parentList->GetCurrentPos()),
311 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'SpinBoxEntryDialog'");
320 infoMap[
"low"] = QString::number(
m_low);
321 infoMap[
"high"] = QString::number(
m_high);
322 infoMap[
"step"] = QString::number(
m_step);
342 for (currPos = 0; currPos < count; currPos++)
345 Qt::CaseInsensitive) == 0)
MythUITextEdit * m_entryEdit
QString m_positiveTemplate
SpinBoxEntryDialog(MythScreenStack *parent, const char *name, MythUIButtonList *parentList, QString searchText, int low, int high, int step)
bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings) override
Parse the xml definition of this widget setting the state of the object accordingly.
void CreateCopy(MythUIType *parent) override
Copy the state of this widget to the one given, it must be of the same type.
MythUIButtonList * m_parentList
static constexpr const char * ACTION_0
MythUIButton * m_okButton
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
QString GetText(void) const
bool MoveDown(MovementUnit unit=MoveItem, uint amount=0) override
static constexpr const char * ACTION_SELECT
static constexpr const char * ACTION_9
void SetRange(int low, int high, int step, uint pageMultiple=5)
Set the lower and upper bounds of the spinbox, the interval and page amount.
static QString parseText(QDomElement &element)
QHash< QString, QString > InfoMap
QString m_negativeTemplate
void SetText(const QString &text, bool moveCursor=true)
MythUISpinBox(MythUIType *parent, const QString &name)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
bool Create(void) override
void BuildFocusList(void)
bool MoveUp(MovementUnit unit=MoveItem, uint amount=0) override
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
MythUIButton * m_cancelButton
void SetEnabled(bool enable)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
The base class on which all widgets and screens are based.
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
void SetTextFromMap(const InfoMap &map)
MythMainWindow * GetMythMainWindow(void)
A widget for offering a range of numerical values where only the the bounding values and interval are...
MythScreenStack * GetStack(const QString &Stackname)
void ShowEntryDialog(QString initialEntry)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void AddSelection(int value, const QString &label="")
Add a special label for a value of the spinbox, it does not need to be in the range.