#include "SVTK_CubeAxesActor2D.h"
#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
#include <qlayout.h>
#include <qframe.h>
aHBox = new QHBox(myLabelsGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("NUMBER"), aHBox);
- myLabelNumber = new QLineEdit(aHBox);
- myLabelNumber->setValidator(new QIntValidator(0, 25, this));
- myLabelNumber->installEventFilter(this);
+ myLabelNumber = new QtxIntSpinBox(0,25,1,aHBox,"SpinBoxLabelNumber");
aLabels.append(aLabel);
aHBox = new QHBox(myLabelsGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("OFFSET"), aHBox);
- myLabelOffset = new QLineEdit(aHBox);
+ myLabelOffset = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxLabellOffset");
aLabels.append(aLabel);
aHBox = new QHBox(myLabelsGrp);
aHBox = new QHBox(myTicksGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("LENGTH"), aHBox);
- myTickLength = new QLineEdit(aHBox);
+ myTickLength = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxTickLength");
+
aLabels.append(aLabel);
// Layout
onTicksChecked();
}
-bool SVTK_AxisWidget::eventFilter(QObject* o, QEvent* e)
-{
- if (e->type() == QEvent::FocusOut) {
- bool isOK = false;
- int k = myLabelNumber->text().toInt(&isOK);
- if (isOK && k > 25) myLabelNumber->setText("25");
- }
- return false;
-}
-
//=======================================================================
// name : SVTK_AxisWidget::onNameChecked
// Purpose :
}
myIsLabelsVisible->setChecked(useLabels);
- myLabelNumber->setText(QString("%1").arg(nbLabels));
- myLabelOffset->setText(QString("%1").arg(anOffset));
+ myLabelNumber->setValue(nbLabels);
+ myLabelOffset->setValue(anOffset);
myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
// Tick marks
int aTickLength = theActor->GetTickLength();
myIsTicksVisible->setChecked(useTickMarks);
- myTickLength->setText(QString("%1").arg(aTickLength));
+ myTickLength->setValue(aTickLength);
return true;
}
theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
- bool isOk = false;
- int nbLabels = myLabelNumber->text().toInt(&isOk);
- if (isOk)
- theActor->SetNumberOfLabels(nbLabels);
+ int nbLabels = myLabelNumber->value();
+ theActor->SetNumberOfLabels(nbLabels);
- int anOffset = myLabelOffset->text().toInt(&isOk);
- if (isOk)
- theActor->SetTickOffset(anOffset);
+ int anOffset = myLabelOffset->value();
+ theActor->SetTickOffset(anOffset);
QColor aLabelsColor(255, 255, 255);
int aLabelsFontFamily = VTK_ARIAL;
// Tick marks
theActor->SetTickVisibility(myIsTicksVisible->isChecked());
- int aTickLength = myTickLength->text().toInt(&isOk);
- if (isOk)
- theActor->SetTickLength(aTickLength);
+ int aTickLength = myTickLength->value();
+ theActor->SetTickLength(aTickLength);
return true;
}
try
{
+ QWidget *aCurrWid = this->focusWidget();
+ aCurrWid->clearFocus();
+ aCurrWid->setFocus();
+
isOk = isOk && myAxes[ 0 ]->Apply(myActor->GetXAxisActor2D());
isOk = isOk && myAxes[ 1 ]->Apply(myActor->GetYAxisActor2D());
isOk = isOk && myAxes[ 2 ]->Apply(myActor->GetZAxisActor2D());
class QGroupBox;
class QtxAction;
+class QtxIntSpinBox;
class vtkAxisActor2D;
class SVTK_CubeAxesActor2D;
bool ReadData( vtkAxisActor2D* );
bool Apply( vtkAxisActor2D* );
-protected:
- bool eventFilter(QObject*, QEvent*);
-
private slots:
void onNameChecked();
void onLabelsChecked();
// labels
QGroupBox* myLabelsGrp;
QCheckBox* myIsLabelsVisible;
- QLineEdit* myLabelNumber;
- QLineEdit* myLabelOffset;
+ QtxIntSpinBox* myLabelNumber;
+ QtxIntSpinBox* myLabelOffset;
SVTK_FontWidget* myLabelsFont;
// tick marks
QGroupBox* myTicksGrp;
QCheckBox* myIsTicksVisible;
- QLineEdit* myTickLength;
+ QtxIntSpinBox* myTickLength;
friend class SVTK_CubeAxesDlg;
};