feat: use Meui.Toast
parent
c6fffc069f
commit
9f8896bdb3
|
@ -41,11 +41,13 @@ void Memory::increase(const QString &curNum) {
|
|||
int temp = m_text.toInt(&success);
|
||||
if (!success) {
|
||||
qDebug() << "Failed to increase memory: String to int conversion failed. (m_text)";
|
||||
emit failed("Failed to increase memory: String to int conversion failed.");
|
||||
return;
|
||||
}
|
||||
int temp2 = curNum.toInt(&success);
|
||||
if (!success) {
|
||||
qDebug() << "Failed to increase memory: String to int conversion failed. (curNum)";
|
||||
emit failed("Failed to increase memory: String to int conversion failed.");
|
||||
return;
|
||||
}
|
||||
temp += temp2;
|
||||
|
@ -59,11 +61,13 @@ void Memory::decrease(const QString &curNum) {
|
|||
int temp = m_text.toInt(&success);
|
||||
if (!success) {
|
||||
qDebug() << "Failed to decrease memory: String to int conversion failed. (m_text)";
|
||||
emit failed("Failed to decrease memory: String to int conversion failed.");
|
||||
return;
|
||||
}
|
||||
int temp2 = curNum.toInt(&success);
|
||||
if (!success) {
|
||||
qDebug() << "Failed to increase memory: String to int conversion failed. (curNum)";
|
||||
qDebug() << "Failed to decrease memory: String to int conversion failed. (curNum)";
|
||||
emit failed("Failed to decrease memory: String to int conversion failed.");
|
||||
return;
|
||||
}
|
||||
temp -= temp2;
|
||||
|
|
1
memory.h
1
memory.h
|
@ -42,6 +42,7 @@ public:
|
|||
|
||||
signals:
|
||||
void textChanged();
|
||||
void failed(const QString &errorString);
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
|
|
|
@ -64,6 +64,14 @@ Item {
|
|||
|
||||
Memory {
|
||||
id: memory
|
||||
onFailed: {
|
||||
toast.text = errorString
|
||||
toast.open = true
|
||||
}
|
||||
}
|
||||
|
||||
Meui.Toast {
|
||||
id: toast
|
||||
}
|
||||
|
||||
function appendToTextField(text) {
|
||||
|
|
Loading…
Reference in New Issue