or from bounding box" issue.
#include "OCCViewer_ClippingDlg.h"
#include <QtxDoubleSpinBox.h>
+#include <QtxDoubleSpinSlider.h>
+#include <QtxIntSpinSlider.h>
#include <QtxAction.h>
#include "SUIT_Session.h"
CBRelativeOrientation->addItem( tr("ALONG_ZX") );
GroupParametersLayout->addWidget( CBRelativeOrientation, 0, 1 );
- TLValueDistance = new QLabel( GroupParameters );
- TLValueDistance->setObjectName( "TLValueDistance" );
- TLValueDistance->setAlignment( Qt::AlignCenter );
- TLValueDistance->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- QFont fnt = TLValueDistance->font(); fnt.setBold( true ); TLValueDistance->setFont( fnt );
- GroupParametersLayout->addWidget( TLValueDistance, 1, 1 );
-
TextLabelDistance = new QLabel( tr("DISTANCE"), GroupParameters );
TextLabelDistance->setObjectName( "TextLabelDistance" );
- GroupParametersLayout->addWidget( TextLabelDistance, 2, 0 );
-
- SliderDistance = new QSlider( Qt::Horizontal, GroupParameters );
- SliderDistance->setObjectName( "SliderDistance" );
- SliderDistance->setFocusPolicy( Qt::NoFocus );
- SliderDistance->setMinimumSize( 300, 0 );
- SliderDistance->setMinimum( 0 );
- SliderDistance->setMaximum( 100 );
- SliderDistance->setSingleStep( 1 );
- SliderDistance->setPageStep( 10 );
- SliderDistance->setTracking( false );
- GroupParametersLayout->addWidget( SliderDistance, 2, 1 );
-
- TLValueRotation1 = new QLabel( GroupParameters );
- TLValueRotation1->setObjectName( "TLValueRotation1" );
- TLValueRotation1->setAlignment( Qt::AlignCenter );
- TLValueRotation1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TLValueRotation1->setFont( fnt );
- GroupParametersLayout->addWidget( TLValueRotation1, 3, 1 );
+ GroupParametersLayout->addWidget( TextLabelDistance, 1, 0 );
+
+ SpinSliderDistance = new QtxDoubleSpinSlider( 0., 1., 0.01, GroupParameters );
+ SpinSliderDistance->setObjectName( "SpinSliderDistance" );
+ SpinSliderDistance->setPrecision( precision );
+ QFont fnt = SpinSliderDistance->font(); fnt.setBold( true ); SpinSliderDistance->setFont( fnt );
+ GroupParametersLayout->addWidget( SpinSliderDistance, 1, 1 );
+
+ QString aUnitRot = "\xB0";
TextLabelRotation1 = new QLabel( tr("ROTATION_AROUND_X_Y2Z"), GroupParameters );
TextLabelRotation1->setObjectName( "TextLabelRotation1" );
- GroupParametersLayout->addWidget( TextLabelRotation1, 4, 0 );
-
- SliderRotation1 = new QSlider( Qt::Horizontal, GroupParameters );
- SliderRotation1->setObjectName( "SliderRotation1" );
- SliderRotation1->setFocusPolicy( Qt::NoFocus );
- SliderRotation1->setMinimumSize( 300, 0 );
- SliderRotation1->setMinimum( -180 );
- SliderRotation1->setMaximum( 180 );
- SliderRotation1->setSingleStep( 1 );
- SliderRotation1->setPageStep( 10 );
- SliderRotation1->setTracking(false);
- GroupParametersLayout->addWidget( SliderRotation1, 4, 1 );
-
- TLValueRotation2 = new QLabel( GroupParameters );
- TLValueRotation2->setObjectName( "TLValueRotation2" );
- TLValueRotation2->setAlignment( Qt::AlignCenter );
- TLValueRotation2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TLValueRotation2->setFont( fnt );
- GroupParametersLayout->addWidget( TLValueRotation2, 5, 1 );
+ GroupParametersLayout->addWidget( TextLabelRotation1, 2, 0 );
+
+ SpinSliderRotation1 = new QtxIntSpinSlider( -180, 180, 1, GroupParameters );
+ SpinSliderRotation1->setObjectName( "SpinSliderRotation1" );
+ SpinSliderRotation1->setUnit( aUnitRot );
+ SpinSliderRotation1->setFont( fnt );
+ GroupParametersLayout->addWidget( SpinSliderRotation1, 2, 1 );
TextLabelRotation2 = new QLabel(tr("ROTATION_AROUND_Y_X2Z"), GroupParameters);
TextLabelRotation2->setObjectName( "TextLabelRotation2" );
TextLabelRotation2->setObjectName( "TextLabelRotation2" );
- GroupParametersLayout->addWidget( TextLabelRotation2, 6, 0 );
-
- SliderRotation2 = new QSlider( Qt::Horizontal, GroupParameters );
- SliderRotation2->setObjectName( "SliderRotation2" );
- SliderRotation2->setFocusPolicy( Qt::NoFocus );
- SliderRotation2->setMinimumSize( 300, 0 );
- SliderRotation2->setMinimum( -180 );
- SliderRotation2->setMaximum( 180 );
- SliderRotation2->setSingleStep( 1 );
- SliderRotation2->setPageStep( 10 );
- SliderRotation2->setTracking(false);
- GroupParametersLayout->addWidget( SliderRotation2, 6, 1 );
+ GroupParametersLayout->addWidget( TextLabelRotation2, 3, 0 );
+
+ SpinSliderRotation2 = new QtxIntSpinSlider( -180, 180, 1, GroupParameters );
+ SpinSliderRotation2->setObjectName( "SpinSliderRotation2" );
+ SpinSliderRotation2->setUnit( aUnitRot );
+ SpinSliderRotation2->setFont( fnt );
+ GroupParametersLayout->addWidget( SpinSliderRotation2, 3, 1 );
/***************************************************************/
QGroupBox* CheckBoxWidget = new QGroupBox( this );
connect( CBAbsoluteOrientation, SIGNAL ( activated ( int ) ), this, SLOT( onOrientationAbsoluteChanged( int ) ) ) ;
connect( CBRelativeOrientation, SIGNAL( activated( int ) ), this, SLOT( onOrientationRelativeChanged( int ) ) );
- connect( SliderDistance, SIGNAL( sliderMoved( int ) ), this, SLOT( SliderDistanceHasMoved( int ) ) );
- connect( SliderDistance, SIGNAL( valueChanged( int ) ), this, SLOT( SliderDistanceHasMoved( int ) ) );
- connect( SliderRotation1, SIGNAL( sliderMoved( int ) ), this, SLOT( SliderRotation1HasMoved( int ) ) );
- connect( SliderRotation1, SIGNAL( valueChanged( int ) ), this, SLOT( SliderRotation1HasMoved( int ) ) );
- connect( SliderRotation2, SIGNAL( sliderMoved( int ) ), this, SLOT( SliderRotation2HasMoved( int ) ) );
- connect( SliderRotation2, SIGNAL( valueChanged( int ) ), this, SLOT( SliderRotation2HasMoved( int ) ) );
+ connect( SpinSliderDistance, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
+ connect( SpinSliderRotation1, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
+ connect( SpinSliderRotation2, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
connect( PreviewCheckBox, SIGNAL ( toggled ( bool ) ), this, SLOT( onPreview( bool ) ) ) ;
connect( AutoApplyCheckBox, SIGNAL ( toggled( bool ) ), this, SLOT( onAutoApply( bool ) ) );
CBAbsoluteOrientation->setCurrentIndex(0);
- TLValueDistance->setText( "0.5" );
- TLValueRotation1->setText( "0\xB0" );
- TLValueRotation2->setText( "0\xB0" );
+ SpinSliderDistance->setValue( 0.5 );
+ SpinSliderRotation1->setValue( 0 );
+ SpinSliderRotation2->setValue( 0 );
CBRelativeOrientation->setCurrentIndex( 0 );
- SliderDistance->setValue( 50 );
- SliderRotation1->setValue( 0 );
- SliderRotation2->setValue( 0 );
}
/*!
}
else if( myCurrentClipPlaneMode == Relative ) {
CBRelativeOrientation->setEnabled( anIsControlsEnable );
- SliderDistance->setEnabled( anIsControlsEnable );
- SliderRotation1->setEnabled( anIsControlsEnable );
- SliderRotation2->setEnabled( anIsControlsEnable );
+ SpinSliderDistance->setEnabled( anIsControlsEnable );
+ SpinSliderRotation1->setEnabled( anIsControlsEnable );
+ SpinSliderRotation2->setEnabled( anIsControlsEnable );
isActivePlane->setEnabled( anIsControlsEnable );
}
isActivePlane->setEnabled( anIsControlsEnable );
int anOrientation = aPlane.RelativeMode.Orientation;
// Set plane parameters in the dialog
- QString aFmtDistance = QString::number( aPlane.RelativeMode.Distance, '.', 2 );
- QString aFmtRotation1 = QString::number( floor( aPlane.RelativeMode.Rotation1 ) );
- QString aFmtRotation2 = QString::number( floor( aPlane.RelativeMode.Rotation2 ) );
- aFmtRotation1 = QString( "%1\xB0" ).arg( aFmtRotation1 );
- aFmtRotation2 = QString( "%1\xB0" ).arg( aFmtRotation2 );
-
- SliderDistance->setValue( aPlane.RelativeMode.Distance * 100 );
- TLValueDistance->setText( aFmtDistance );
- SliderRotation1->setValue( floor( aPlane.RelativeMode.Rotation1 ) );
- TLValueRotation1->setText( aFmtRotation1 );
- SliderRotation2->setValue( floor( aPlane.RelativeMode.Rotation2 ) );
- TLValueRotation2->setText( aFmtRotation2 );
+ double aFmtDistance = double(aPlane.RelativeMode.Distance);
+ int aFmtRotation1 = int(aPlane.RelativeMode.Rotation1);
+ int aFmtRotation2 = int(aPlane.RelativeMode.Rotation2);
+
+ SpinSliderDistance->setValue( aFmtDistance );
+ SpinSliderRotation1->setValue( aFmtRotation1 );
+ SpinSliderRotation2->setValue( aFmtRotation2 );
CBRelativeOrientation->setCurrentIndex( anOrientation );
onOrientationRelativeChanged( anOrientation );
}
else if( aPlane.PlaneMode == Relative )
{
aPlane.RelativeMode.Orientation = CBRelativeOrientation->currentIndex();
- aPlane.RelativeMode.Distance = TLValueDistance->text().toDouble();
- aPlane.RelativeMode.Rotation1 = TLValueRotation1->text().remove("\xB0").toInt();
- aPlane.RelativeMode.Rotation2 = TLValueRotation2->text().remove("\xB0").toInt();
+ aPlane.RelativeMode.Distance = SpinSliderDistance->value();
+ aPlane.RelativeMode.Rotation1 = SpinSliderRotation1->value();
+ aPlane.RelativeMode.Rotation2 = SpinSliderRotation2->value();
relativePlaneToAbsolute( aPlane, myModel->getAISContext(),myModel->trihedronSize() );
}
aPlane.IsOn = isActivePlane->isChecked();
}
}
-/*!
- SLOT: Called when value of slider distance change
-*/
-void OCCViewer_ClippingDlg::SliderDistanceHasMoved( int value )
-{
- double new_value = value/100.;
- TLValueDistance->setText( QString("%1").arg( new_value ) );
- onValueChanged();
-}
-
-/*!
- SLOT: Called when value of slider rotation1 change
-*/
-void OCCViewer_ClippingDlg::SliderRotation1HasMoved( int value )
-{
- TLValueRotation1->setText( QString("%1\xB0").arg( value ) );
- onValueChanged();
-}
-
-/*!
- SLOT: Called when value of slider rotation2 change
-*/
-void OCCViewer_ClippingDlg::SliderRotation2HasMoved( int value )
-{
- TLValueRotation2->setText( QString("%1\xB0").arg( value ) );
- onValueChanged();
-}
-
OCCViewer_ClipPlane& OCCViewer_ClippingDlg::getClipPlane( int theIdx )
{
return myLocalPlanes[theIdx];
class QComboBox;
class QCheckBox;
class QtxDoubleSpinBox;
+class QtxDoubleSpinSlider;
+class QtxIntSpinSlider;
class QStackedLayout;
class QSlider;
class QMenu;
QLabel* TextLabelDistance;
QLabel* TextLabelRotation1;
QLabel* TextLabelRotation2;
- QLabel* TLValueDistance;
- QLabel* TLValueRotation1;
- QLabel* TLValueRotation2;
- QSlider* SliderDistance;
- QSlider* SliderRotation1;
- QSlider* SliderRotation2;
+ QtxDoubleSpinSlider* SpinSliderDistance;
+ QtxIntSpinSlider* SpinSliderRotation1;
+ QtxIntSpinSlider* SpinSliderRotation2;
QComboBox* CBRelativeOrientation;
QCheckBox* PreviewCheckBox;
void onPreview( bool on );
void onAutoApply(bool);
- void SliderDistanceHasMoved(int);
- void SliderRotation1HasMoved(int);
- void SliderRotation2HasMoved(int);
-
void onPlaneClicked( const Handle_AIS_Plane& thePlane );
void onPlaneDragged( const Handle_AIS_Plane& thePlane );
};
QtxDockAction.h
QtxDockWidget.h
QtxDoubleSpinBox.h
+ QtxDoubleSpinSlider.h
QtxFontEdit.h
QtxGridBox.h
QtxGroupBox.h
QtxIntSpinBox.h
+ QtxIntSpinSlider.h
QtxListAction.h
QtxLogoMgr.h
QtxMRUAction.h
QtxRubberBand.h
QtxSearchTool.h
QtxShortcutEdit.h
+ QtxSlider.h
QtxSplash.h
QtxToolBar.h
QtxToolTip.h
QtxDockAction.cxx
QtxDockWidget.cxx
QtxDoubleSpinBox.cxx
+ QtxDoubleSpinSlider.cxx
QtxEvalExpr.cxx
QtxFontEdit.cxx
QtxGridBox.cxx
QtxGroupBox.cxx
QtxIntSpinBox.cxx
+ QtxIntSpinSlider.cxx
QtxListAction.cxx
QtxLogoMgr.cxx
QtxMRUAction.cxx
QtxRubberBand.cxx
QtxSearchTool.cxx
QtxShortcutEdit.cxx
+ QtxSlider.cxx
QtxSplash.cxx
QtxToolBar.cxx
QtxToolTip.cxx
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : QtxDoubleSpinSlider.cxx
+// Author : Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
+
+#include "QtxDoubleSpinSlider.h"
+
+/*!
+ * CONSTRUCTOR of double spin box
+ */
+QtxDoubleSpinSlider::QtxDoubleSpinSlider( QWidget* theParent ) : QtxSlider( theParent )
+{
+ // Get default value of slider
+ double aMin = mySlider->minimum() / 100.;
+ double aMax = mySlider->maximum() / 100.;
+ double aStep = mySlider->singleStep() / 100.;
+
+ // Create double spin box
+ myDoubleSpinBox = new QtxDoubleSpinBox( aMin, aMax, aStep, theParent );
+ myDoubleSpinBox->setFixedWidth( 100 );
+
+ // Add widget in main layout
+ mainLayout->addWidget( myDoubleSpinBox );
+
+ // Signals and slots connections
+ connect( myDoubleSpinBox, SIGNAL(valueChanged( double )), this, SLOT(DoubleSpinHasChanged( double )) );
+ connect( this, SIGNAL(valueUpdated( int )), this, SLOT(setValue( int )) );
+}
+
+QtxDoubleSpinSlider::QtxDoubleSpinSlider( double theMin, double theMax, double theStep, QWidget* theParent ) : QtxSlider( theParent )
+{
+ // Set value of slider
+ mySlider->setRange( int(theMin*100), int(theMax*100) );
+ mySlider->setSingleStep( int(theStep*100) );
+
+ // Create double spin box
+ myDoubleSpinBox = new QtxDoubleSpinBox( theMin, theMax, theStep, theParent );
+ myDoubleSpinBox->setFixedWidth( 100 );
+
+ // Add widget in main layout
+ mainLayout->addWidget( myDoubleSpinBox );
+
+ // Signals and slots connections
+ connect( myDoubleSpinBox, SIGNAL(valueChanged( double )), this, SLOT(DoubleSpinHasChanged( double )) );
+ connect( this, SIGNAL(valueUpdated( int )), this, SLOT(setValue( int )) );
+}
+
+/*!
+ * DESTRUCTOR of double spin box
+ */
+QtxDoubleSpinSlider::~QtxDoubleSpinSlider()
+{
+ // Empty
+}
+
+/*!
+ SLOT: Called when the value of double spin box
+*/
+void QtxDoubleSpinSlider::DoubleSpinHasChanged( double theValue )
+{
+
+ int aNewValue = int( theValue * 100 );
+ mySlider->blockSignals( true );
+ mySlider->setValue( aNewValue );
+ mySlider->blockSignals( false );
+ emit valueChanged( theValue );
+}
+
+/*!
+ * Get font currently set for the double spin box
+*/
+QFont QtxDoubleSpinSlider::font()
+{
+ return myDoubleSpinBox->font();
+}
+
+/*!
+ * Set font currently set for the double spin box
+*/
+void QtxDoubleSpinSlider::setFont( QFont& theFont )
+{
+ myDoubleSpinBox->setFont( theFont );
+}
+
+/*!
+ * Get value in double spin box
+*/
+double QtxDoubleSpinSlider::value()
+{
+ return myDoubleSpinBox->value();
+}
+
+/*!
+ * Set value in double spin box
+*/
+void QtxDoubleSpinSlider::setValue( double theValue )
+{
+ myDoubleSpinBox->setValue( theValue );
+}
+
+/*!
+ * Set value in double spin box
+*/
+void QtxDoubleSpinSlider::setValue( int theValue )
+{
+ double aNewValue = theValue / 100.;
+ this->setValue( aNewValue );
+}
+
+/*!
+ * Set precision of double spin box
+*/
+void QtxDoubleSpinSlider::setPrecision( int thePrecision )
+{
+ myDoubleSpinBox->setPrecision( thePrecision );
+}
+
+/*!
+ * Get precision of double spin box
+*/
+int QtxDoubleSpinSlider::precision()
+{
+ myDoubleSpinBox->getPrecision();
+}
+
+void QtxDoubleSpinSlider::setUnit( QString& theUnit )
+{
+ myDoubleSpinBox->setSuffix( theUnit );
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : QtxDoubleSpinSlider.h
+// Author : Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
+
+
+#ifndef QTXDOUBLESPINSLIDER_H
+#define QTXDOUBLESPINSLIDER_H
+
+#include "Qtx.h"
+#include "QtxDoubleSpinBox.h"
+#include "QtxSlider.h"
+
+
+class QTX_EXPORT QtxDoubleSpinSlider : public QtxSlider
+{
+ Q_OBJECT
+public:
+ QtxDoubleSpinSlider( QWidget* = 0 );
+ QtxDoubleSpinSlider( double, double, double, QWidget* = 0 );
+ virtual ~QtxDoubleSpinSlider();
+
+ QFont font();
+ void setFont( QFont& );
+
+ double value();
+ void setValue( double );
+
+ void setPrecision( int );
+ int precision();
+
+ void setUnit( QString& );
+
+public slots:
+ void setValue( int );
+
+private slots:
+ void DoubleSpinHasChanged( double );
+
+signals:
+ void valueChanged( double );
+
+private:
+ QtxDoubleSpinBox* myDoubleSpinBox;
+};
+
+#endif /* QTXDOUBLESPINSLIDER_H */
+
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : QtxIntSpinSlider.cxx
+// Author : Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
+
+#include "QtxIntSpinSlider.h"
+
+/*!
+ * CONSTRUCTOR of spin box
+ */
+QtxIntSpinSlider::QtxIntSpinSlider( QWidget* theParent ) : QtxSlider( theParent )
+{
+ // Get default value of slider
+ int aMin = mySlider->minimum();
+ int aMax = mySlider->maximum();
+ int aStep = mySlider->singleStep();
+
+ // Create spin box
+ myIntSpinBox = new QtxIntSpinBox( aMin, aMax, aStep, theParent );
+ myIntSpinBox->setFixedWidth( 100 );
+
+ // Add widget in main layout
+ mainLayout->addWidget( myIntSpinBox );
+
+ // Signals and slots connections
+ connect( myIntSpinBox, SIGNAL(valueChanged( int )), this, SLOT(IntSpinHasChanged( int )) );
+ connect( this, SIGNAL(valueUpdated( int )), this, SLOT(setValue( int )) );
+}
+
+QtxIntSpinSlider::QtxIntSpinSlider( int theMin, int theMax, int theStep, QWidget* theParent )
+{
+ // Set value of slider
+ mySlider->setRange( theMin, theMax );
+ mySlider->setSingleStep( theStep );
+
+ // Create spin box
+ myIntSpinBox = new QtxIntSpinBox( theMin, theMax, theStep, theParent );
+ myIntSpinBox->setFixedWidth( 100 );
+
+ // Add widgets in main layout
+ mainLayout->addWidget( myIntSpinBox );
+
+ // Signals and slots connections
+ connect( myIntSpinBox, SIGNAL(valueChanged( int )), this, SLOT(IntSpinHasChanged( int )) );
+ connect( this, SIGNAL(valueUpdated( int )), this, SLOT(setValue( int )) );
+}
+
+/*!
+ * DESTRUCTOR of spin box
+ */
+QtxIntSpinSlider::~QtxIntSpinSlider()
+{
+ // Empty
+}
+
+/*!
+ SLOT: Called when the value of spin box change
+*/
+void QtxIntSpinSlider::IntSpinHasChanged( int theValue )
+{
+ mySlider->blockSignals( true );
+ mySlider->setValue( theValue );
+ mySlider->blockSignals( false );
+ emit valueChanged( theValue );
+}
+
+/*!
+ * Get font of spin box
+*/
+QFont QtxIntSpinSlider::font()
+{
+ return myIntSpinBox->font();
+}
+
+/*!
+ * Set font of spin box
+*/
+void QtxIntSpinSlider::setFont( QFont& theFont )
+{
+ myIntSpinBox->setFont( theFont );
+}
+
+/*!
+ * Get value of spin box
+*/
+int QtxIntSpinSlider::value()
+{
+ return myIntSpinBox->value();
+}
+
+/*!
+ * Set value of spin box
+*/
+void QtxIntSpinSlider::setValue( int theValue )
+{
+ myIntSpinBox->setValue( theValue );
+}
+
+void QtxIntSpinSlider::setUnit( QString& theUnit )
+{
+ myIntSpinBox->setSuffix( theUnit );
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : QtxIntSpinSlider.h
+// Author : Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
+
+
+#ifndef QTXINTSPINSLIDER_H
+#define QTXINTSPINSLIDER_H
+
+#include "Qtx.h"
+#include "QtxIntSpinBox.h"
+#include "QtxSlider.h"
+
+
+class QTX_EXPORT QtxIntSpinSlider : public QtxSlider
+{
+ Q_OBJECT
+public:
+ QtxIntSpinSlider( QWidget* = 0 );
+ QtxIntSpinSlider( int, int, int, QWidget* = 0 );
+ virtual ~QtxIntSpinSlider();
+
+ QFont font();
+ void setFont( QFont& );
+
+ int value();
+
+ void setUnit( QString& );
+
+public slots:
+ void setValue( int );
+
+signals:
+ void valueChanged( int );
+
+private slots:
+ void IntSpinHasChanged( int );
+
+private:
+ QtxIntSpinBox* myIntSpinBox;
+};
+
+#endif /* QTXINTSPINSLIDER_H */
+
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : QtxSlider.cxx
+// Author : Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
+
+#include "QtxSlider.h"
+
+/*!
+ * CONSTRUCTOR of slider
+ */
+QtxSlider::QtxSlider( QWidget* theParent ) : QWidget( theParent )
+{
+ // Create slider
+ mySlider = new QSlider( Qt::Horizontal, theParent );
+ mySlider->setFocusPolicy( Qt::NoFocus );
+ mySlider->setMinimumSize( 250, 0 );
+ mySlider->setTracking( false );
+
+ // Add widgets in main layout
+ mainLayout = new QHBoxLayout();
+ mainLayout->addWidget( mySlider );
+ mainLayout->setContentsMargins( 0, 0, 0, 0 );
+ this->setLayout( mainLayout );
+
+ // Signals and slots connections
+ connect( mySlider, SIGNAL(sliderMoved( int )), this, SLOT(SliderHasMoved( int )) );
+ connect( mySlider, SIGNAL(valueChanged( int )), this, SLOT(SliderHasMoved( int )) );
+}
+
+QtxSlider::QtxSlider( int theMin, int theMax, int theStep, QWidget* theParent ) : QWidget( theParent )
+{
+ // Create slider
+ mySlider = new QSlider( Qt::Horizontal, theParent );
+ mySlider->setFocusPolicy( Qt::NoFocus );
+ mySlider->setMinimumSize( 200, 0 );
+ mySlider->setRange( theMin, theMax );
+ mySlider->setSingleStep( theStep );
+ mySlider->setPageStep( 10 );
+ mySlider->setTracking( false );
+
+ // Add widgets in main layout
+ mainLayout = new QHBoxLayout();
+ mainLayout->addWidget( mySlider );
+ mainLayout->setContentsMargins( 0, 0, 0, 0 );
+ this->setLayout( mainLayout );
+
+ // Signals and slots connections
+ connect( mySlider, SIGNAL(sliderMoved( int )), this, SLOT(SliderHasMoved( int )) );
+ connect( mySlider, SIGNAL(valueChanged( int )), this, SLOT(SliderHasMoved( int )) );
+}
+
+/*!
+ * DESTRUCTOR of slider
+ */
+QtxSlider::~QtxSlider()
+{
+ // Empty
+}
+
+/*!
+ SLOT: Called when the value of slider change
+*/
+void QtxSlider::SliderHasMoved( int theValue )
+{
+ emit valueUpdated( theValue );
+}
+
+/*!
+ * Get value of slider
+*/
+int QtxSlider::value()
+{
+ return mySlider->value();
+}
+
+/*!
+ * Set value of slider
+*/
+void QtxSlider::setValue( int theValue )
+{
+ mySlider->setValue( theValue );
+}
+
+/*!
+ * Set range of slider
+*/
+void QtxSlider::setRange( int theMin, int theMax )
+{
+ mySlider->setRange( theMin, theMax );
+}
+
+/*!
+ * Set single step of slider
+*/
+void QtxSlider::setSingleStep( int theStep )
+{
+ mySlider->setSingleStep( theStep );
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : QtxSlider.h
+// Author : Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
+
+
+#ifndef QTXSLIDER_H
+#define QTXSLIDER_H
+
+#include <QWidget>
+#include <QHBoxLayout>
+#include <QSlider>
+
+#include "Qtx.h"
+
+
+class QTX_EXPORT QtxSlider : public QWidget
+{
+ Q_OBJECT
+public:
+ QtxSlider( QWidget* = 0 );
+ QtxSlider( int, int, int, QWidget* = 0 );
+ virtual ~QtxSlider();
+
+ void setValue( int );
+ int value();
+
+ void setRange( int, int );
+
+ void setSingleStep( int );
+
+private slots:
+ void SliderHasMoved( int );
+
+signals:
+ void valueUpdated( int );
+
+protected:
+ QHBoxLayout* mainLayout;
+ QSlider* mySlider;
+};
+
+#endif /* QTXSLIDER_H */
+