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, bool readonly=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
bool m_readonly
int this_base
int this_native_base

Additional Inherited Members

Public Slots inherited from dbe::widgets::editors::base
virtual void slot_set_initial_loaded ()
Public Attributes inherited from dbe::widgets::editors::base
const QString c_input_placeholder {"Add a new value"}
const QString c_no_object_placeholder {"No Object currently set"}
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 300 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,
bool readonly = false )

Definition at line 1191 of file BuildingBlockEditors.cpp.

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

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

◆ buildtooltip()

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

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

Definition at line 1307 of file BuildingBlockEditors.cpp.

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

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

◆ ChangeFormatDec

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

Definition at line 1860 of file BuildingBlockEditors.cpp.

1861{
1862 ChangeFormat ( 0 );
1863}

◆ ChangeFormatHex

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

Definition at line 1865 of file BuildingBlockEditors.cpp.

1866{
1867 ChangeFormat ( 1 );
1868}

◆ ChangeFormatOct

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

Definition at line 1870 of file BuildingBlockEditors.cpp.

1871{
1872 ChangeFormat ( 2 );
1873}

◆ checkIfDuplicated

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

Definition at line 1609 of file BuildingBlockEditors.cpp.

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

◆ checkRange()

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

Definition at line 1507 of file BuildingBlockEditors.cpp.

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

◆ closeEvent()

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

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

Definition at line 1324 of file BuildingBlockEditors.cpp.

1325{
1326 Q_UNUSED ( Event )
1327 emit signal_force_close();
1328}

◆ GetLineEdit()

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

Definition at line 1264 of file BuildingBlockEditors.cpp.

1265{
1266 return LineEdit;
1267}

◆ SetController()

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

Definition at line 1330 of file BuildingBlockEditors.cpp.

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

◆ setdefaults()

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

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

Definition at line 1258 of file BuildingBlockEditors.cpp.

1259{
1260 this_defaults = ValueDefault;
1261 LineEdit->SetDefaultValue ( this_defaults );
1262}

◆ SetEditor()

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

change here

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

Definition at line 1269 of file BuildingBlockEditors.cpp.

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

◆ ShowWarning()

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

Definition at line 1348 of file BuildingBlockEditors.cpp.

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

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

◆ ValidateFloatValue()

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

Definition at line 1582 of file BuildingBlockEditors.cpp.

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

◆ ValidateIntegerValue()

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

Definition at line 1373 of file BuildingBlockEditors.cpp.

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

Member Data Documentation

◆ m_readonly

bool dbe::widgets::editors::numericattr::m_readonly
private

Definition at line 328 of file BuildingBlockEditors.hpp.

◆ this_base

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

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

◆ this_native_base

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

Definition at line 330 of file BuildingBlockEditors.hpp.


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