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;
|
||||
for (int i = 0; i < vlanTagCount->value(); i++)
|
||||
count *= vlans->item(i, kVlanCount)->text().toUInt();
|
||||
vlanCount->setText(QString::number(count));
|
||||
vlanCount->setValue(count);
|
||||
|
||||
updateTotalDeviceCount();
|
||||
}
|
||||
|
||||
void DeviceGroupDialog::updateTotalDeviceCount()
|
||||
{
|
||||
totalDeviceCount->setText(QString::number(
|
||||
qMax(vlanCount->text().toInt(), 1)
|
||||
* devicePerVlanCount->value()));
|
||||
totalDeviceCount->setValue(qMax(vlanCount->value(), 1)
|
||||
* devicePerVlanCount->value());
|
||||
}
|
||||
|
||||
void DeviceGroupDialog::updateIp4Gateway()
|
||||
|
@ -63,7 +63,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="vlanCount" >
|
||||
<widget class="IntEdit" name="vlanCount" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -90,7 +90,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6" >
|
||||
<widget class="QLineEdit" name="totalDeviceCount" >
|
||||
<widget class="IntEdit" name="totalDeviceCount" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -321,6 +321,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ip6edit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>IntEdit</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>intedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<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