add a formatted spin box
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1119557
This commit is contained in:
parent
004e83447b
commit
f8e81095ea
|
@ -0,0 +1,33 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui/formattedspinbox.h"
|
||||||
|
|
||||||
|
#include <kglobal.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
|
||||||
|
QString FormattedSpinBox::textFromValue(double value) const
|
||||||
|
{
|
||||||
|
return KGlobal::locale()->formatNumber(value, decimals());
|
||||||
|
}
|
||||||
|
|
||||||
|
double FormattedSpinBox::valueFromText(const QString& text) const
|
||||||
|
{
|
||||||
|
return KGlobal::locale()->readNumber(text);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(FORMATTEDSPINBOX__H)
|
||||||
|
|
||||||
|
#define FORMATTEDSPINBOX__H
|
||||||
|
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
|
||||||
|
class FormattedSpinBox : public QDoubleSpinBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FormattedSpinBox(QWidget* parent = NULL) : QDoubleSpinBox(parent) {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual QString textFromValue(double value) const;
|
||||||
|
virtual double valueFromText(const QString& text) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -70,7 +70,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="m_SpinFirstSector">
|
<widget class="FormattedSpinBox" name="m_SpinFirstSector">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>3</horstretch>
|
<horstretch>3</horstretch>
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="m_SpinLastSector">
|
<widget class="FormattedSpinBox" name="m_SpinLastSector">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>3</horstretch>
|
<horstretch>3</horstretch>
|
||||||
|
@ -177,6 +177,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FormattedSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header>gui/formattedspinbox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -216,7 +216,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1" colspan="2">
|
<item row="7" column="1" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="m_SpinFreeBefore">
|
<widget class="FormattedSpinBox" name="m_SpinFreeBefore">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>3</horstretch>
|
<horstretch>3</horstretch>
|
||||||
|
@ -251,7 +251,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1" colspan="2">
|
<item row="8" column="1" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="m_SpinCapacity">
|
<widget class="FormattedSpinBox" name="m_SpinCapacity">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>3</horstretch>
|
<horstretch>3</horstretch>
|
||||||
|
@ -286,7 +286,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1" colspan="2">
|
<item row="9" column="1" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="m_SpinFreeAfter">
|
<widget class="FormattedSpinBox" name="m_SpinFreeAfter">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>3</horstretch>
|
<horstretch>3</horstretch>
|
||||||
|
@ -336,6 +336,11 @@
|
||||||
<header>gui/partresizerwidget.h</header>
|
<header>gui/partresizerwidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>FormattedSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header>gui/formattedspinbox.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>m_RadioPrimary</tabstop>
|
<tabstop>m_RadioPrimary</tabstop>
|
||||||
|
|
Loading…
Reference in New Issue