@@ -160,6 +160,8 @@ class MainWindowItem : public QObject {
160
160
out << boost::any_cast<int >(optionValue);
161
161
}else if (isType<unsigned long >(optionValue)) {
162
162
out << boost::any_cast<unsigned long >(optionValue);
163
+ }if (isType<unsigned int >(optionValue)) {
164
+ out << boost::any_cast<unsigned int >(optionValue);
163
165
}else if (isType<unsigned short >(optionValue)) {
164
166
out << boost::any_cast<unsigned short >(optionValue);
165
167
}else out << boost::any_cast<std::string>(optionValue); // let it throw
@@ -332,22 +334,28 @@ class IntegerStringItem : public BaseFormattedStringItem {
332
334
virtual QString toString (){return QString::number (boost::any_cast<int >(optionValue));}
333
335
virtual boost::any fromString (QString s){return boost::any (std::stoi (s.toStdString ()));}
334
336
};
335
- class UIntStringItem : public BaseFormattedStringItem {
337
+ class ULongStringItem : public BaseFormattedStringItem {
336
338
public:
337
- UIntStringItem (ConfigOption option_, QLineEdit* lineEdit_, QString fieldNameTranslated_, MainWindow* mw) :
339
+ ULongStringItem (ConfigOption option_, QLineEdit* lineEdit_, QString fieldNameTranslated_, MainWindow* mw) :
338
340
BaseFormattedStringItem (option_, lineEdit_, fieldNameTranslated_,
339
- QApplication::tr (" Must be a valid integer." ), mw) {}
340
- virtual ~UIntStringItem (){}
341
+ QApplication::tr (" Must be a valid long integer." ), mw) {}
342
+ virtual ~ULongStringItem (){}
341
343
virtual bool isValid (bool & alreadyDisplayedIfWrong){
342
344
bool correct = BaseFormattedStringItem::isValid (alreadyDisplayedIfWrong);
343
345
if (!correct)return false ;
344
346
alreadyDisplayedIfWrong = false ;
345
347
auto str=lineEdit->text ();
346
348
bool ok;
347
- str.toUInt (&ok);
349
+ str.toULong (&ok);
348
350
return ok;
349
351
}
350
- virtual QString toString (){return QString::number (boost::any_cast<unsigned int >(optionValue));}
352
+ virtual QString toString (){
353
+ if (isType<unsigned int >(optionValue))
354
+ return QString::number (boost::any_cast<unsigned int >(optionValue));
355
+ else
356
+ return QString::number (boost::any_cast<unsigned long >(optionValue));
357
+
358
+ }
351
359
virtual boost::any fromString (QString s){return boost::any (std::stoul (s.toStdString ()));}
352
360
};
353
361
class UShortStringItem : public BaseFormattedStringItem {
@@ -563,7 +571,7 @@ public slots:
563
571
void initTCPPortBox (ConfigOption option, QLineEdit* portLineEdit, QString fieldNameTranslated);
564
572
void initCheckBox (ConfigOption option, QCheckBox* checkBox);
565
573
void initIntegerBox (ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
566
- void initUIntBox (ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
574
+ void initULongBox (ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
567
575
void initUInt32Box (ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
568
576
void initUInt16Box (ConfigOption option, QLineEdit* numberLineEdit, QString fieldNameTranslated);
569
577
void initStringBox (ConfigOption option, QLineEdit* lineEdit);
0 commit comments