Device Emulation (contd.): Added a IntEdit class and used in DeviceGroup Dialog
This commit is contained in:
parent
2d8510cd3a
commit
0ef0c6cfc0
@ -173,16 +173,15 @@ void DeviceGroupDialog::updateTotalVlanCount()
|
|||||||
int count = vlanTagCount->value() ? 1 : 0;
|
int count = vlanTagCount->value() ? 1 : 0;
|
||||||
for (int i = 0; i < vlanTagCount->value(); i++)
|
for (int i = 0; i < vlanTagCount->value(); i++)
|
||||||
count *= vlans->item(i, kVlanCount)->text().toUInt();
|
count *= vlans->item(i, kVlanCount)->text().toUInt();
|
||||||
vlanCount->setText(QString::number(count));
|
vlanCount->setValue(count);
|
||||||
|
|
||||||
updateTotalDeviceCount();
|
updateTotalDeviceCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceGroupDialog::updateTotalDeviceCount()
|
void DeviceGroupDialog::updateTotalDeviceCount()
|
||||||
{
|
{
|
||||||
totalDeviceCount->setText(QString::number(
|
totalDeviceCount->setValue(qMax(vlanCount->value(), 1)
|
||||||
qMax(vlanCount->text().toInt(), 1)
|
* devicePerVlanCount->value());
|
||||||
* devicePerVlanCount->value()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceGroupDialog::updateIp4Gateway()
|
void DeviceGroupDialog::updateIp4Gateway()
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QLineEdit" name="vlanCount" >
|
<widget class="IntEdit" name="vlanCount" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="6" >
|
<item row="0" column="6" >
|
||||||
<widget class="QLineEdit" name="totalDeviceCount" >
|
<widget class="IntEdit" name="totalDeviceCount" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -321,6 +321,11 @@
|
|||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>ip6edit.h</header>
|
<header>ip6edit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>IntEdit</class>
|
||||||
|
<extends>QSpinBox</extends>
|
||||||
|
<header>intedit.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>name</tabstop>
|
<tabstop>name</tabstop>
|
||||||
|
41
common/intedit.h
Normal file
41
common/intedit.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2016 Srivats P.
|
||||||
|
|
||||||
|
This file is part of "Ostinato"
|
||||||
|
|
||||||
|
This is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INT_EDIT_H
|
||||||
|
#define _INT_EDIT_H
|
||||||
|
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
class IntEdit: public QSpinBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IntEdit(QWidget *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline IntEdit::IntEdit(QWidget *parent)
|
||||||
|
: QSpinBox(parent)
|
||||||
|
{
|
||||||
|
setRange(INT_MIN, INT_MAX);
|
||||||
|
setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user