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 289 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 1199 of file BuildingBlockEditors.cpp.

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

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

◆ buildtooltip()

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

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

Definition at line 1310 of file BuildingBlockEditors.cpp.

1311{
1312 t_virtue const & Virtue = this_base_data_editor->get();
1313
1314 setToolTip (
1315 QString ( "Attribute Name: %1 \n" ).arg ( Virtue.p_name.c_str() ) + QString (
1316 " Type: %1 \n" ).arg (
1317 dunedaq::conffwk::attribute_t::type2str ( Virtue.p_type ) )
1318 + QString ( " Range: %1 \n" ).arg ( Virtue.p_range.c_str() )
1319 + QString ( " Format: %1 \n" ).arg (
1320 dunedaq::conffwk::attribute_t::format2str ( Virtue.p_int_format ) )
1321 + QString ( " Not Null: %1 \n" ).arg ( Virtue.p_is_not_null )
1322 + QString ( " Is Multi Value: %1 \n" ).arg ( Virtue.p_is_multi_value )
1323 + QString ( " Default Value: %1 \n" ).arg ( Virtue.p_default_value.c_str() )
1324 + QString ( " Description: %1 \n" ).arg ( Virtue.p_description.c_str() ) );
1325}
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 1732 of file BuildingBlockEditors.cpp.

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

◆ ChangeFormatDec

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

Definition at line 1863 of file BuildingBlockEditors.cpp.

1864{
1865 ChangeFormat ( 0 );
1866}

◆ ChangeFormatHex

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

Definition at line 1868 of file BuildingBlockEditors.cpp.

1869{
1870 ChangeFormat ( 1 );
1871}

◆ ChangeFormatOct

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

Definition at line 1873 of file BuildingBlockEditors.cpp.

1874{
1875 ChangeFormat ( 2 );
1876}

◆ checkIfDuplicated

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

Definition at line 1612 of file BuildingBlockEditors.cpp.

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

◆ checkRange()

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

Definition at line 1510 of file BuildingBlockEditors.cpp.

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

◆ closeEvent()

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

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

Definition at line 1327 of file BuildingBlockEditors.cpp.

1328{
1329 Q_UNUSED ( Event )
1330 emit signal_force_close();
1331}

◆ GetLineEdit()

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

Definition at line 1267 of file BuildingBlockEditors.cpp.

1268{
1269 return LineEdit;
1270}

◆ SetController()

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

Definition at line 1333 of file BuildingBlockEditors.cpp.

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

◆ setdefaults()

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

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

Definition at line 1261 of file BuildingBlockEditors.cpp.

1262{
1263 this_defaults = ValueDefault;
1264 LineEdit->SetDefaultValue ( this_defaults );
1265}

◆ SetEditor()

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

change here

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

Definition at line 1272 of file BuildingBlockEditors.cpp.

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

◆ ShowWarning()

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

Definition at line 1351 of file BuildingBlockEditors.cpp.

1352{
1353 LineEdit->setPalette ( StyleUtility::AlertStatusBarPallete );
1354
1355 t_virtue const & Virtue = this_base_data_editor->get();
1356
1357 QString Message = QString ( "The value for attribute %1 is in the wrong format" ).arg (
1358 Virtue.p_name.c_str() );
1359
1360 if ( Range != "" )
1361 {
1362 QString RangeMex = QString ( " - The value should be in the range : %1" ).arg ( Range );
1363 Message.append ( "\n\n" + RangeMex );
1364 }
1365
1366 if ( Format != "" )
1367 {
1368 Message.append ( QString ( "\n\n - The value should be formatted as a %1." ).arg (
1369 Format ) );
1370 }
1371
1372 QMessageBox::warning ( this, tr ( "Wrong value" ), Message );
1373 return;
1374}
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 1845 of file BuildingBlockEditors.cpp.

1846{
1847 Q_UNUSED ( Dummy )
1848
1849 if ( this_base_data_editor->must_not_be_null() and ( LineEdit->text().isEmpty() ) )
1850 {
1851 this_base_data_editor->set_valid ( false );
1852 }
1853 else if ( this_base_data_editor->must_not_be_null() and ( this_data.size() == 0 ) )
1854 {
1855 this_base_data_editor->set_valid ( false );
1856 }
1857 else
1858 {
1859 this_base_data_editor->set_valid ( true );
1860 }
1861}

◆ ValidateFloatValue()

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

Definition at line 1585 of file BuildingBlockEditors.cpp.

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

◆ ValidateIntegerValue()

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

Definition at line 1376 of file BuildingBlockEditors.cpp.

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

Member Data Documentation

◆ this_base

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

Definition at line 316 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 314 of file BuildingBlockEditors.hpp.

◆ this_native_base

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

Definition at line 317 of file BuildingBlockEditors.hpp.


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