DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::widgets::editors::numericattr Class Reference

#include <BuildingBlockEditors.hpp>

Inheritance diagram for dbe::widgets::editors::numericattr:
[legend]
Collaboration diagram for dbe::widgets::editors::numericattr:
[legend]

Public Types

typedef dunedaq::conffwk::attribute_t t_virtue
typedef editor_data< t_virtuet_build_block_editor

Signals

void signal_value_duplicated ()
Signals inherited from dbe::widgets::editors::base
void signal_force_close ()
void signal_edit_end ()
void signal_internal_value_change ()
void signal_value_change ()

Public Member Functions

 numericattr (t_virtue const &attr, QWidget *parent=nullptr, bool owned=false)
void SetEditor () override
QLineEdit * GetLineEdit () const
virtual void setdefaults (const QString &ValueDefault)
Public Member Functions inherited from dbe::widgets::editors::base
template<typename T = editor_data_state>
std::shared_ptr< T > dataeditor ()
virtual void setdata (QStringList const &)
void setchanged (bool)
bool ischanged () const
virtual QStringList getdata ()
template<>
std::shared_ptr< editor_data_statedataeditor ()

Private Slots

void checkIfDuplicated ()
void AddToList ()
void ChangeFormat (int i)
void UpdateActions (QString Dummy)
void ChangeFormatDec ()
void ChangeFormatHex ()
void ChangeFormatOct ()

Private Member Functions

void buildtooltip () override
void closeEvent (QCloseEvent *Event)
void SetController ()
void ShowWarning (QString Format="", QString Range="")
bool ValidateIntegerValue (QString const &)
bool ValidateFloatValue (QString const &)
bool checkRange (QString const &)

Private Attributes

std::shared_ptr< t_build_block_editorthis_base_data_editor
int this_base
int this_native_base

Additional Inherited Members

Public Slots inherited from dbe::widgets::editors::base
virtual void slot_set_initial_loaded ()
Protected Member Functions inherited from dbe::widgets::editors::base
 base (std::shared_ptr< editor_data_state > editordata, QWidget *parent=nullptr, bool owned=false)
Protected Attributes inherited from dbe::widgets::editors::base
std::shared_ptr< editor_data_statep_data_editor
QString this_defaults
QStringList this_data
bool this_is_owned
bool this_value_changed
bool this_initial_load

Detailed Description

Definition at line 294 of file BuildingBlockEditors.hpp.

Member Typedef Documentation

◆ t_build_block_editor

◆ t_virtue

Constructor & Destructor Documentation

◆ numericattr()

dbe::widgets::editors::numericattr::numericattr ( t_virtue const & attr,
QWidget * parent = nullptr,
bool owned = false )

Definition at line 1204 of file BuildingBlockEditors.cpp.

1206 :
1207 base ( std::make_shared<t_build_block_editor> ( attr ), parent, owned ),
1208 this_base_data_editor ( std::static_pointer_cast<t_build_block_editor> ( p_data_editor ) ),
1209 this_native_base ( -1 )
1210{
1211 setupUi ( this );
1212 t_virtue const & Virtue = this_base_data_editor->get();
1213
1214 setWindowTitle ( QString ( "Edit Attribute: %1" ).arg ( Virtue.p_name.c_str() ) );
1215 LineEdit->SetPopupMenu();
1216
1217 if ( Virtue.p_is_not_null )
1218 {
1219 this_base_data_editor->set_valid ( false );
1220 LineEdit->setPalette ( StyleUtility::WarningStatusBarPallete );
1221 }
1222 else
1223 {
1224 LineEdit->SetNullCheck ( false );
1225 }
1226
1227 if ( ! ( Virtue.p_type == dunedaq::conffwk::float_type
1228 || Virtue.p_type == dunedaq::conffwk::double_type ) )
1229 {
1230 if ( Virtue.p_int_format == dunedaq::conffwk::oct_int_format )
1231 {
1232 FormatBox->setCurrentIndex ( 2 );
1233 this_base = 8;
1234 this_native_base = 8;
1235 }
1236 else if ( Virtue.p_int_format == dunedaq::conffwk::dec_int_format )
1237 {
1238 FormatBox->setCurrentIndex ( 0 );
1239 this_base = 10;
1240 this_native_base = 10;
1241 }
1242 else if ( Virtue.p_int_format == dunedaq::conffwk::hex_int_format )
1243 {
1244 FormatBox->setCurrentIndex ( 1 );
1245 this_base = 16;
1246 this_native_base = 16;
1247 }
1248
1249 FormatBox->hide();
1250 }
1251 else
1252 {
1253 FormatBox->hide();
1254 }
1255
1256 SetController();
1257
1258 AttributeName->setText ( QString ( Virtue.p_name.c_str() ) + " : " );
1259 AttributeName->setHidden ( true );
1260 buildtooltip();
1261
1262 QString Dummy ( "Dummy" );
1263 UpdateActions ( Dummy );
1264}
static QPalette WarningStatusBarPallete
base(std::shared_ptr< editor_data_state > editordata, QWidget *parent=nullptr, bool owned=false)
std::shared_ptr< editor_data_state > p_data_editor
std::shared_ptr< t_build_block_editor > this_base_data_editor
dunedaq::conffwk::attribute_t t_virtue

Member Function Documentation

◆ AddToList

void dbe::widgets::editors::numericattr::AddToList ( )
privateslot

Definition at line 1629 of file BuildingBlockEditors.cpp.

1630{
1631 // No change in data, do nothing
1632 // It avoids some unwanted loops when focus is acquired/lost
1633 if ( this_data.contains(LineEdit->text()) ) {
1634 return;
1635 }
1636
1637 auto convert_to_proper_base = [this] (const QString& value) -> QString {
1638 if((value.isEmpty() == false) && (this_native_base != -1) && (this_native_base != this_base)) {
1639 QString cnvrtd;
1640
1641 t_virtue const & virtue = this_base_data_editor->get();
1642 bool Unsigned = ( virtue.p_type == dunedaq::conffwk::u8_type
1643 || virtue.p_type == dunedaq::conffwk::u16_type
1644 || virtue.p_type == dunedaq::conffwk::u32_type
1645 || virtue.p_type == dunedaq::conffwk::u64_type );
1646
1647 if(Unsigned == true) {
1648 cnvrtd.setNum(LineEdit->text().toULongLong(0, this_base), this_native_base);
1649 } else {
1650 cnvrtd.setNum(LineEdit->text().toLongLong(0, this_base), this_native_base);
1651 }
1652
1653 // Be careful to set the contextaul menu properly
1654 if(this_native_base == 8) {
1655 if(cnvrtd.startsWith("0") == false) {
1656 cnvrtd.insert(0, "0");
1657 }
1658 LineEdit->EmitOctSlot();
1659 } else if(this_native_base == 10) {
1660 LineEdit->EmitDecSlot();
1661 } else if(this_native_base == 16) {
1662 if(cnvrtd.startsWith("0x", Qt::CaseInsensitive) == false) {
1663 cnvrtd.insert(0, "0x");
1664 }
1665 LineEdit->EmitHexSlot();
1666 }
1667
1668 // The current and native bases are now the same
1670
1671 return cnvrtd;
1672 }
1673
1674 return value;
1675 };
1676
1677 LineEdit->blockSignals ( true );
1678
1679 BOOST_SCOPE_EXIT(this_)
1680 {
1681 this_->LineEdit->blockSignals ( false );
1682 }
1683 BOOST_SCOPE_EXIT_END
1684
1685 bool isValid = true;
1686
1687 QString input = LineEdit->text();
1688
1689 t_virtue const & virtue = this_base_data_editor->get();
1690 if ( ( virtue.p_type == dunedaq::conffwk::float_type
1691 or virtue.p_type == dunedaq::conffwk::double_type ))
1692 {
1693 if (not ValidateFloatValue ( input )) {
1694 isValid = false;
1695 }
1696 } else if ( not ValidateIntegerValue ( input ) )
1697 {
1698 isValid = false;
1699 }
1700
1701 // ShowWarning("FLOAT", QString::fromStdString(virtue.p_name));
1702
1703 this_data.clear();
1704
1705 // We better save data in the proper format, in order to avoid issues
1706 // with conversions (and having data saved in a bad format)
1707 this_data.append ( convert_to_proper_base(input) );
1708
1709 this_value_changed = true;
1710
1711 if(isValid == true) {
1712 QString Dummy ( "Dummy" );
1713 UpdateActions ( Dummy );
1714 } else {
1715 this_base_data_editor->set_valid ( false );
1716 }
1717
1718 if ( not this_is_owned )
1719 {
1720 // Not owned: multiattr (connected to signal_value_change) and
1721 // CustomDelegate (connected to signal_edit_end and signal_force_close)
1722 if(isValid == true) {
1723 // Do not emit the signal in this case
1724 // The table will try t write data and get back an exception
1725 emit signal_edit_end();
1726 }
1727
1728 emit signal_value_change();
1729 }
1730 else
1731 {
1732 // Owned: ObjectEditor (connected to signal_value_change)
1733 emit signal_value_change();
1734 }
1735}

◆ buildtooltip()

void dbe::widgets::editors::numericattr::buildtooltip ( )
overrideprivatevirtual

Implements dbe::widgets::editors::base.

Definition at line 1315 of file BuildingBlockEditors.cpp.

1316{
1317 t_virtue const & Virtue = this_base_data_editor->get();
1318
1319 setToolTip (
1320 QString ( "Attribute Name: %1 \n" ).arg ( Virtue.p_name.c_str() ) + QString (
1321 " Type: %1 \n" ).arg (
1322 dunedaq::conffwk::attribute_t::type2str ( Virtue.p_type ) )
1323 + QString ( " Range: %1 \n" ).arg ( Virtue.p_range.c_str() )
1324 + QString ( " Format: %1 \n" ).arg (
1325 dunedaq::conffwk::attribute_t::format2str ( Virtue.p_int_format ) )
1326 + QString ( " Not Null: %1 \n" ).arg ( Virtue.p_is_not_null )
1327 + QString ( " Is Multi Value: %1 \n" ).arg ( Virtue.p_is_multi_value )
1328 + QString ( " Default Value: %1 \n" ).arg ( Virtue.p_default_value.c_str() )
1329 + QString ( " Description: %1 \n" ).arg ( Virtue.p_description.c_str() ) );
1330}
static const char * type2str(type_t type)
static const char * format2str(int_format_t format)

◆ ChangeFormat

void dbe::widgets::editors::numericattr::ChangeFormat ( int i)
privateslot

Definition at line 1737 of file BuildingBlockEditors.cpp.

1738{
1739 QString CurrentString = LineEdit->text();
1740
1741 if ( CurrentString.isEmpty() )
1742 {
1743 //if(DecButton->isChecked())
1744
1745 if ( i == 0 )
1746 {
1747 this_base = 10;
1748 }
1749
1750 //else if(OctButton->isChecked())
1751 else if ( i == 2 )
1752 {
1753 this_base = 8;
1754 }
1755
1756 //else if(HexButton->isChecked())
1757 else if ( i == 1 )
1758 {
1759 this_base = 16;
1760 }
1761
1762 return;
1763 }
1764
1765 QString ConvertedString;
1766 t_virtue const & Virtue = this_base_data_editor->get();
1767
1768 bool Unsigned = ( Virtue.p_type == dunedaq::conffwk::u8_type
1769 || Virtue.p_type == dunedaq::conffwk::u16_type || Virtue.p_type == dunedaq::conffwk::u32_type
1770 || Virtue.p_type == dunedaq::conffwk::u64_type );
1771 bool OkConversion = false;
1772
1773 //if(DecButton->isChecked())
1774
1775 if ( i == 0 )
1776 {
1777 if ( Unsigned )
1778 {
1779 ConvertedString.setNum ( CurrentString.toULongLong ( &OkConversion, 0 ), 10 );
1780 }
1781 else
1782 {
1783 ConvertedString.setNum ( CurrentString.toLongLong ( &OkConversion, 0 ), 10 );
1784 }
1785
1786 this_base = 10;
1787 }
1788
1789 //else if(OctButton->isChecked())
1790 else if ( i == 2 )
1791 {
1792 if ( Unsigned )
1793 {
1794 ConvertedString.setNum ( CurrentString.toULongLong ( &OkConversion, 0 ), 8 );
1795 }
1796 else
1797 {
1798 ConvertedString.setNum ( CurrentString.toLongLong ( &OkConversion, 0 ), 8 );
1799 }
1800
1801 ConvertedString.insert(0, "0");
1802 this_base = 8;
1803 }
1804
1805 //else if(HexButton->isChecked())
1806 else if ( i == 1 )
1807 {
1808 if ( Unsigned )
1809 {
1810 ConvertedString.setNum ( CurrentString.toULongLong ( &OkConversion, 0 ), 16 );
1811 }
1812 else
1813 {
1814 ConvertedString.setNum ( CurrentString.toLongLong ( &OkConversion, 0 ), 16 );
1815 }
1816
1817 ConvertedString.insert(0, "0x");
1818 this_base = 16;
1819 }
1820
1821 if ( !OkConversion )
1822 {
1823 QString Format;
1824
1825 if ( this_native_base == 10 )
1826 {
1827 Format = "DECIMAL";
1828 }
1829 else if ( this_native_base == 16 )
1830 {
1831 Format = "HEX-DECIMAL";
1832 }
1833 else if ( this_native_base == 8 )
1834 {
1835 Format = "OCT-DECIMAL";
1836 }
1837
1838 ShowWarning ( Format );
1839
1840 return;
1841 }
1842
1843 if ( !ConvertedString.isEmpty() )
1844 {
1845 LineEdit->clear();
1846 LineEdit->setText ( ConvertedString );
1847 }
1848}
void ShowWarning(QString Format="", QString Range="")

◆ ChangeFormatDec

void dbe::widgets::editors::numericattr::ChangeFormatDec ( )
privateslot

Definition at line 1868 of file BuildingBlockEditors.cpp.

1869{
1870 ChangeFormat ( 0 );
1871}

◆ ChangeFormatHex

void dbe::widgets::editors::numericattr::ChangeFormatHex ( )
privateslot

Definition at line 1873 of file BuildingBlockEditors.cpp.

1874{
1875 ChangeFormat ( 1 );
1876}

◆ ChangeFormatOct

void dbe::widgets::editors::numericattr::ChangeFormatOct ( )
privateslot

Definition at line 1878 of file BuildingBlockEditors.cpp.

1879{
1880 ChangeFormat ( 2 );
1881}

◆ checkIfDuplicated

void dbe::widgets::editors::numericattr::checkIfDuplicated ( )
privateslot

Definition at line 1617 of file BuildingBlockEditors.cpp.

1617 {
1618 // Emit a special signal when the Enter/Return key is pressed
1619 // and the data have not been changed
1620 // That is useful, for instance, for the multi-attribute
1621 // widget in order to add multiple times the same attribute
1622 // (you do not want to add the same value multiple times just
1623 // when the focus is lost)
1624 if ( this_data.contains(LineEdit->text()) ) {
1626 }
1627}

◆ checkRange()

bool dbe::widgets::editors::numericattr::checkRange ( QString const & Value)
private

Definition at line 1515 of file BuildingBlockEditors.cpp.

1516{
1517 t_virtue const & Virtue = this_base_data_editor->get();
1518
1519 QString Range = QString::fromStdString ( Virtue.p_range );
1520
1521 if ( Range.isEmpty() )
1522 {
1523 return true;
1524 }
1525
1526 QStringList ValueList = Range.split ( "," );
1527
1528 QList<QPair<QString, QString>> RangeList;
1529
1530 for ( QString & RangeValue : ValueList )
1531 {
1532 if ( RangeValue.contains ( ".." ) )
1533 {
1534 QStringList Ranges = RangeValue.split ( ".." );
1535 RangeList.append ( QPair<QString, QString> ( Ranges.at ( 0 ), Ranges.at ( 1 ) ) );
1536 ValueList.removeOne ( RangeValue );
1537 }
1538 }
1539
1540 if ( ValueList.contains ( Value ) )
1541 {
1542 return true;
1543 }
1544
1545 for ( QPair<QString, QString> & ValuePair : RangeList )
1546 {
1547 if ( ValuePair.first == "*" )
1548 {
1549 if ( Value.toDouble() <= ValuePair.second.toDouble() )
1550 {
1551 return true;
1552 }
1553
1554 ShowWarning("", Range);
1555
1556 return false;
1557 }
1558
1559 else if ( ValuePair.second == "*" )
1560 {
1561 if ( Value.toDouble() >= ValuePair.first.toDouble() )
1562 {
1563 return true;
1564 }
1565
1566 ShowWarning("", Range);
1567
1568 return false;
1569 }
1570
1571 else
1572 {
1573 if ( ( Value.toDouble() >= ValuePair.first.toDouble() ) &&
1574 ( Value.toDouble() <= ValuePair.second.toDouble() ) )
1575 {
1576 return true;
1577 }
1578
1579 ShowWarning("", Range);
1580
1581 return false;
1582 }
1583 }
1584
1585 ShowWarning("", Range);
1586
1587 return false;
1588}

◆ closeEvent()

void dbe::widgets::editors::numericattr::closeEvent ( QCloseEvent * Event)
privatevirtual

Reimplemented from dbe::widgets::editors::base.

Definition at line 1332 of file BuildingBlockEditors.cpp.

1333{
1334 Q_UNUSED ( Event )
1335 emit signal_force_close();
1336}

◆ GetLineEdit()

QLineEdit * dbe::widgets::editors::numericattr::GetLineEdit ( ) const

Definition at line 1272 of file BuildingBlockEditors.cpp.

1273{
1274 return LineEdit;
1275}

◆ SetController()

void dbe::widgets::editors::numericattr::SetController ( )
private

Definition at line 1338 of file BuildingBlockEditors.cpp.

1339{
1340 connect ( LineEdit, SIGNAL ( DecChange() ), this, SLOT ( ChangeFormatDec() ) );
1341 connect ( LineEdit, SIGNAL ( OctChange() ), this, SLOT ( ChangeFormatOct() ) );
1342 connect ( LineEdit, SIGNAL ( HexChange() ), this, SLOT ( ChangeFormatHex() ) );
1343
1344 connect ( FormatBox, SIGNAL ( currentIndexChanged ( int ) ),
1345 this, SLOT ( ChangeFormat ( int ) ), Qt::UniqueConnection );
1346
1347 connect ( LineEdit, SIGNAL ( editingFinished() ),
1348 this, SLOT ( AddToList() ), Qt::UniqueConnection );
1349 connect ( LineEdit, SIGNAL ( textChanged ( QString ) ),
1350 this, SLOT ( UpdateActions ( QString ) ), Qt::UniqueConnection );
1351 connect ( LineEdit, SIGNAL ( returnPressed () ),
1352 this, SLOT ( checkIfDuplicated () ), Qt::UniqueConnection );
1353
1354}

◆ setdefaults()

void dbe::widgets::editors::numericattr::setdefaults ( const QString & ValueDefault)
virtual

Reimplemented from dbe::widgets::editors::base.

Definition at line 1266 of file BuildingBlockEditors.cpp.

1267{
1268 this_defaults = ValueDefault;
1269 LineEdit->SetDefaultValue ( this_defaults );
1270}

◆ SetEditor()

void dbe::widgets::editors::numericattr::SetEditor ( )
overridevirtual

change here

Implements dbe::widgets::editors::base.

Definition at line 1277 of file BuildingBlockEditors.cpp.

1278{
1279 if ( this_data.isEmpty() )
1280 {
1281 return;
1282 }
1283
1284 LineEdit->clear();
1285
1287 if ( this_base == 16 )
1288 {
1289 if ( not this_data.value ( 0 ).startsWith ( "0x" ) )
1290 {
1291 LineEdit->setText ( "0x" + this_data.value ( 0 ) );
1292 }
1293 else
1294 {
1295 LineEdit->setText ( this_data.value ( 0 ) );
1296 }
1297 }
1298 else if ( this_base == 8 )
1299 {
1300 if ( not this_data.value ( 0 ).startsWith ( "0" ) and this_data.value ( 0 ) != 0 )
1301 {
1302 LineEdit->setText ( "0" + this_data.value ( 0 ) );
1303 }
1304 else
1305 {
1306 LineEdit->setText ( this_data.value ( 0 ) );
1307 }
1308 }
1309 else
1310 {
1311 LineEdit->setText ( this_data.value ( 0 ) );
1312 }
1313}

◆ ShowWarning()

void dbe::widgets::editors::numericattr::ShowWarning ( QString Format = "",
QString Range = "" )
private

Definition at line 1356 of file BuildingBlockEditors.cpp.

1357{
1358 LineEdit->setPalette ( StyleUtility::AlertStatusBarPallete );
1359
1360 t_virtue const & Virtue = this_base_data_editor->get();
1361
1362 QString Message = QString ( "The value for attribute %1 is in the wrong format" ).arg (
1363 Virtue.p_name.c_str() );
1364
1365 if ( Range != "" )
1366 {
1367 QString RangeMex = QString ( " - The value should be in the range : %1" ).arg ( Range );
1368 Message.append ( "\n\n" + RangeMex );
1369 }
1370
1371 if ( Format != "" )
1372 {
1373 Message.append ( QString ( "\n\n - The value should be formatted as a %1." ).arg (
1374 Format ) );
1375 }
1376
1377 QMessageBox::warning ( this, tr ( "Wrong value" ), Message );
1378 return;
1379}
static QPalette AlertStatusBarPallete

◆ signal_value_duplicated

void dbe::widgets::editors::numericattr::signal_value_duplicated ( )
signal

◆ UpdateActions

void dbe::widgets::editors::numericattr::UpdateActions ( QString Dummy)
privateslot

Definition at line 1850 of file BuildingBlockEditors.cpp.

1851{
1852 Q_UNUSED ( Dummy )
1853
1854 if ( this_base_data_editor->must_not_be_null() and ( LineEdit->text().isEmpty() ) )
1855 {
1856 this_base_data_editor->set_valid ( false );
1857 }
1858 else if ( this_base_data_editor->must_not_be_null() and ( this_data.size() == 0 ) )
1859 {
1860 this_base_data_editor->set_valid ( false );
1861 }
1862 else
1863 {
1864 this_base_data_editor->set_valid ( true );
1865 }
1866}

◆ ValidateFloatValue()

bool dbe::widgets::editors::numericattr::ValidateFloatValue ( QString const & Value)
private

Definition at line 1590 of file BuildingBlockEditors.cpp.

1591{
1592 bool validValue = true;
1593
1594 t_virtue const & Virtue = this_base_data_editor->get();
1595
1596 if(Virtue.p_type == dunedaq::conffwk::float_type) {
1597 bool ok;
1598 Value.toFloat(&ok);
1599
1600 if(ok == false) {
1601 ShowWarning("FLOAT");
1602 validValue = false;
1603 }
1604 } else {
1605 bool ok;
1606 Value.toDouble(&ok);
1607
1608 if(ok == false) {
1609 ShowWarning("DOUBLE");
1610 validValue = false;
1611 }
1612 }
1613
1614 return (validValue && checkRange(Value));
1615}

◆ ValidateIntegerValue()

bool dbe::widgets::editors::numericattr::ValidateIntegerValue ( QString const & text)
private

Definition at line 1381 of file BuildingBlockEditors.cpp.

1382{
1383 auto checkInteger = [this, text]()
1384 {
1385 t_virtue const & input = this_base_data_editor->get();
1386
1387 bool convert_to_defined_base;
1388
1389 qlonglong NewLongLong{0};
1390 qulonglong NewULongLong{0};
1391
1392 auto check_convert = [this, &convert_to_defined_base]()
1393 {
1394 // If input cannot be converted to any base then show a warning and invalidate
1395
1396 if ( not convert_to_defined_base )
1397 {
1398 if ( this_native_base == 10 )
1399 {
1400 ShowWarning ( "DECIMAL" );
1401 }
1402 else if ( this_native_base == 16 )
1403 {
1404 ShowWarning ( "HEX-DECIMAL" );
1405 }
1406 else if ( this_native_base == 8 )
1407 {
1408 ShowWarning ( "OCT-DECIMAL" );
1409 }
1410
1411 return false;
1412 }
1413
1414 return true;
1415 };
1416
1417 if ( input.p_type == dunedaq::conffwk::u8_type
1418 or input.p_type == dunedaq::conffwk::u16_type
1419 or input.p_type == dunedaq::conffwk::u32_type
1420 or input.p_type == dunedaq::conffwk::u64_type )
1421 {
1422 NewULongLong = text.toULongLong ( &convert_to_defined_base, this_base );
1423
1424 if ( not check_convert() )
1425 {
1426 return false;
1427 }
1428
1429 qulonglong min_u;
1430 qulonglong max_u;
1431
1432 if ( input.p_type == dunedaq::conffwk::u8_type )
1433 {
1434 min_u = 0;
1435 max_u = UCHAR_MAX;
1436 }
1437 else if ( input.p_type == dunedaq::conffwk::u16_type )
1438 {
1439 min_u = 0;
1440 max_u = USHRT_MAX;
1441 }
1442 else if ( input.p_type == dunedaq::conffwk::u32_type )
1443 {
1444 min_u = 0;
1445 max_u = ULONG_MAX;
1446 }
1447 else if ( input.p_type == dunedaq::conffwk::u64_type )
1448 {
1449 min_u = 0;
1450 max_u = ULONG_LONG_MAX;
1451 }
1452 else
1453 {
1454 return true;
1455 }
1456
1457 if ( min_u <= NewULongLong and NewULongLong <= max_u )
1458 {
1459 return true;
1460 }
1461
1462 ShowWarning ( "", QString ( "[%1 - %2]" ).arg ( min_u ).arg ( max_u ) );
1463 }
1464 else
1465 {
1466 NewLongLong = text.toLongLong ( &convert_to_defined_base, this_base );
1467
1468 if ( not check_convert() )
1469 {
1470 return false;
1471 }
1472
1473 qlonglong min_s;
1474 qlonglong max_s;
1475
1476 if ( input.p_type == dunedaq::conffwk::s8_type )
1477 {
1478 min_s = SCHAR_MIN;
1479 max_s = SCHAR_MAX;
1480 }
1481 else if ( input.p_type == dunedaq::conffwk::s16_type )
1482 {
1483 min_s = SHRT_MIN;
1484 max_s = SHRT_MAX;
1485 }
1486 else if ( input.p_type == dunedaq::conffwk::s32_type )
1487 {
1488 min_s = LONG_MIN;
1489 max_s = LONG_MAX;
1490 }
1491 else if ( input.p_type == dunedaq::conffwk::s64_type )
1492 {
1493 min_s = - ( LONG_LONG_MAX ) - 1;
1494 max_s = LONG_LONG_MAX;
1495 }
1496 else
1497 {
1498 return true;
1499 }
1500
1501 if ( min_s <= NewLongLong and NewLongLong <= max_s )
1502 {
1503 return true;
1504 }
1505
1506 ShowWarning ( "", QString ( "[%1 - %2]" ).arg ( min_s ).arg ( max_s ) );
1507 }
1508
1509 return false;
1510 };
1511
1512 return (checkInteger() && checkRange(text));
1513}

Member Data Documentation

◆ this_base

int dbe::widgets::editors::numericattr::this_base
private

Definition at line 321 of file BuildingBlockEditors.hpp.

◆ this_base_data_editor

std::shared_ptr<t_build_block_editor> dbe::widgets::editors::numericattr::this_base_data_editor
private

Definition at line 319 of file BuildingBlockEditors.hpp.

◆ this_native_base

int dbe::widgets::editors::numericattr::this_native_base
private

Definition at line 322 of file BuildingBlockEditors.hpp.


The documentation for this class was generated from the following files: