Commit d9d993c9 authored by Nicolas Vuaille's avatar Nicolas Vuaille Committed by Mathieu Westphal

Refactor Time display options

  * Concerning: time inspector, time widget in toolbar, property panel.
  * Add a 'Time Format' setting (sci, fixed or mixed)
  * Synchronize display options (notation, precisions) with settings
  * In 'Snap to timesteps' mode, use a combobox for available times
parent 113d6d69
......@@ -37,7 +37,23 @@
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/timestepValue" command="spin" arguments="down" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget" command="mouseMove" arguments="1,0,0,245,7" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget" command="mouseRelease" arguments="1,0,0,245,7" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/timestepValue" command="spin" arguments="up" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/timeValueComboBox" command="activated" arguments="2" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/radioButtonValue" command="set_boolean" arguments="true" />
<pqcheck object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/timeValue" property="text" arguments="2" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/radioButtonStep" command="set_boolean" arguments="true" />
<pqcheck object="pqClientMainWindow/currentTimeToolbar/AnimationTimeWidget/timeValueComboBox" property="currentText" arguments="2" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_Edit" />
<pqevent object="pqClientMainWindow/menubar/menu_Edit" command="activate" arguments="actionEditSettings" />
<pqevent object="pqClientMainWindow/ApplicationSettings/stackedWidget/ScrollAreaGeneralSettings/qt_scrollarea_viewport/Container/ProxyWidget/AnimationTimeNotation/ComboBox" command="activated" arguments="Scientific" />
<pqevent object="pqClientMainWindow/ApplicationSettings/stackedWidget/ScrollAreaGeneralSettings/qt_scrollarea_viewport/Container/ProxyWidget/AnimationTimePrecision/LineEdit0" command="set_string" arguments="4" />
<pqevent object="pqClientMainWindow/ApplicationSettings/buttonBox/1QPushButton0" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/currentTimeToolbar/AnimationTimeWidget/timeValueComboBox" property="currentText" arguments="2.0000e+0" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_Edit" />
<pqevent object="pqClientMainWindow/menubar/menu_Edit" command="activate" arguments="actionEditSettings" />
<pqevent object="pqClientMainWindow/ApplicationSettings/stackedWidget/ScrollAreaGeneralSettings/qt_scrollarea_viewport/Container/ProxyWidget/AnimationTimeNotation/ComboBox" command="activated" arguments="Mixed" />
<pqevent object="pqClientMainWindow/ApplicationSettings/stackedWidget/ScrollAreaGeneralSettings/qt_scrollarea_viewport/Container/ProxyWidget/AnimationTimePrecision/LineEdit0" command="set_string" arguments="6" />
<pqevent object="pqClientMainWindow/ApplicationSettings/buttonBox/1QPushButton0" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/currentTimeToolbar/AnimationTimeWidget/timeValueComboBox" property="currentText" arguments="2" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/radioButtonValue" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/radioButtonStep" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/timeInspectorDock/timeInspectorPanel/AnimationTimeWidget/timestepValue" command="spin" arguments="up" />
......
# Improve Time Display and Time Selection
* This add a new 'Time Notation' setting (scientific, fixed or mixed).
Time display is automatically updated when settings (precision or notation) change.
In 'Snap to timesteps' mode, the available times are selectable from a combobox,
so going to a specific time is easier and faster.
......@@ -319,6 +319,22 @@
</Hints>
</IntVectorProperty>
<IntVectorProperty name="AnimationTimeNotation"
number_of_elements="1"
default_values="0"
command="SetAnimationTimeNotation"
panel_visibility="advanced">
<Documentation>
Set the display notation for the time in the animation toolbar. 'Mixed' will automatically
choose the shortest display.
</Documentation>
<EnumerationDomain name="enum">
<Entry text="Mixed" value="0" />
<Entry text="Scientific" value="1" />
<Entry text="Fixed" value="2" />
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty name="AnimationTimePrecision"
number_of_elements="1"
default_values="6"
......@@ -326,7 +342,7 @@
panel_visibility="advanced">
<Documentation>
Set the number of significant digits displayed for the time in the animation
toolbar.
toolbar. Should be in the range [1,17].
</Documentation>
<IntRangeDomain min="1" max="17" />
</IntVectorProperty>
......@@ -443,6 +459,7 @@
<Property name="CacheGeometryForAnimation" />
<Property name="AnimationGeometryCacheLimit" />
<Property name="AnimationTimePrecision" />
<Property name="AnimationTimeNotation" />
<Property name="ShowAnimationShortcuts" />
</PropertyGroup>
......
......@@ -50,13 +50,14 @@ vtkPVGeneralSettings::vtkPVGeneralSettings()
, ScalarBarMode(vtkPVGeneralSettings::AUTOMATICALLY_HIDE_SCALAR_BARS)
, CacheGeometryForAnimation(false)
, AnimationGeometryCacheLimit(0)
, AnimationTimePrecision(17)
, AnimationTimePrecision(6)
, ShowAnimationShortcuts(0)
, PropertiesPanelMode(vtkPVGeneralSettings::ALL_IN_ONE)
, LockPanels(false)
, GUIFontSize(0)
, GUIOverrideFont(false)
, ColorByBlockColorsOnApply(true)
, AnimationTimeNotation('g')
{
this->SetDefaultViewType("RenderView");
}
......@@ -229,3 +230,20 @@ void vtkPVGeneralSettings::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "PropertiesPanelMode: " << this->PropertiesPanelMode << "\n";
os << indent << "LockPanels: " << this->LockPanels << "\n";
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetAnimationTimeNotation(int notation)
{
switch (notation)
{
case vtkPVGeneralSettings::SCIENTIFIC:
this->SetAnimationTimeNotation('e');
break;
case vtkPVGeneralSettings::FIXED:
this->SetAnimationTimeNotation('f');
break;
case vtkPVGeneralSettings::MIXED:
default:
this->SetAnimationTimeNotation('g');
}
}
......@@ -156,10 +156,26 @@ public:
/**
* Set the precision of the animation time toolbar.
*/
vtkSetMacro(AnimationTimePrecision, int);
vtkSetClampMacro(AnimationTimePrecision, int, 1, 17);
vtkGetMacro(AnimationTimePrecision, int);
//@}
enum
{
MIXED = 0,
SCIENTIFIC,
FIXED
};
//@{
/**
* Set the notation for the animation time toolbar.
*/
void SetAnimationTimeNotation(int notation);
vtkSetMacro(AnimationTimeNotation, char);
vtkGetMacro(AnimationTimeNotation, char);
//@}
//@{
/**
* Set when animation shortcuts are shown.
......@@ -265,6 +281,7 @@ protected:
bool GUIOverrideFont;
int ConsoleFontSize;
bool ColorByBlockColorsOnApply;
char AnimationTimeNotation;
private:
vtkPVGeneralSettings(const vtkPVGeneralSettings&) = delete;
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>346</width>
<width>400</width>
<height>27</height>
</rect>
</property>
......@@ -19,11 +19,20 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,0,1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,0,0,1">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -53,6 +62,9 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="timeValueComboBox"/>
</item>
<item>
<widget class="QRadioButton" name="radioButtonStep">
<property name="layoutDirection">
......
......@@ -49,7 +49,7 @@ void pqAnimationTimeToolbar::constructor()
this->connect(pqPVApplicationCore::instance()->animationManager(),
SIGNAL(activeSceneChanged(pqAnimationScene*)), SLOT(setAnimationScene(pqAnimationScene*)));
pqCoreUtilities::connect(vtkPVGeneralSettings::GetInstance(), vtkCommand::ModifiedEvent, this,
SLOT(updateTimePrecision()));
SLOT(updateTimeDisplay()));
}
//-----------------------------------------------------------------------------
......@@ -59,7 +59,7 @@ void pqAnimationTimeToolbar::setAnimationScene(pqAnimationScene* scene)
}
//-----------------------------------------------------------------------------
void pqAnimationTimeToolbar::updateTimePrecision()
void pqAnimationTimeToolbar::updateTimeDisplay()
{
if (this->AnimationTimeWidget->timePrecision() !=
vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision())
......@@ -67,6 +67,9 @@ void pqAnimationTimeToolbar::updateTimePrecision()
this->AnimationTimeWidget->setTimePrecision(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision());
}
this->AnimationTimeWidget->setTimeNotation(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimeNotation());
}
//-----------------------------------------------------------------------------
......
......@@ -68,7 +68,10 @@ public:
private slots:
void setAnimationScene(pqAnimationScene* scene);
void updateTimePrecision();
/**
* Update the notation and precision for time display.
*/
void updateTimeDisplay();
private:
Q_DISABLE_COPY(pqAnimationTimeToolbar)
......
......@@ -49,11 +49,13 @@ public:
pqPropertyLinks Links;
int CachedTimestepCount;
int Precision;
QChar TimeNotation;
pqInternals(pqAnimationTimeWidget* self)
: AnimationSceneVoidPtr(NULL)
, CachedTimestepCount(-1)
, Precision(17)
, Precision(6)
, TimeNotation('g')
{
this->Ui.setupUi(self);
this->Ui.timeValue->setValidator(new QDoubleValidator(self));
......@@ -99,10 +101,12 @@ pqAnimationTimeWidget::pqAnimationTimeWidget(QWidget* parentObject)
this->setEnabled(false);
Ui::AnimationTimeWidget& ui = this->Internals->Ui;
ui.timeValueComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
this->connect(ui.timeValue, SIGNAL(textChangedAndEditingFinished()), SLOT(timeLineEditChanged()));
this->connect(ui.radioButtonValue, SIGNAL(toggled(bool)), SIGNAL(playModeChanged()));
this->connect(
ui.radioButtonValue, SIGNAL(toggled(bool)), SLOT(updateTimestepCountLabelVisibility()));
ui.timeValueComboBox, SIGNAL(currentTextChanged(QString)), SLOT(timeComboBoxChanged()));
ui.timeValueComboBox->setVisible(false);
this->connect(ui.radioButtonValue, SIGNAL(toggled(bool)), SLOT(timeRadioButtonToggled()));
this->connect(
ui.timestepValue, SIGNAL(valueChangedAndEditingFinished()), SLOT(timeSpinBoxChanged()));
}
......@@ -167,7 +171,19 @@ void pqAnimationTimeWidget::setTimeValue(double time)
{
Ui::AnimationTimeWidget& ui = this->Internals->Ui;
ui.timeValue->setProperty("PQ_DOUBLE_VALUE", QVariant(time));
ui.timeValue->setTextAndResetCursor(QString::number(time, 'g', this->Internals->Precision));
QString textValue =
QString::number(time, this->Internals->TimeNotation.toLatin1(), this->Internals->Precision);
ui.timeValue->setTextAndResetCursor(textValue);
for (int index = 0; index < ui.timeValueComboBox->count(); index++)
{
if (ui.timeValueComboBox->itemData(index).toDouble() == time)
{
ui.timeValueComboBox->setCurrentIndex(index);
break;
}
}
bool prev = ui.timestepValue->blockSignals(true);
int index = vtkSMTimeKeeperProxy::GetLowerBoundTimeStepIndex(this->timeKeeper(), time);
ui.timestepValue->setValue(index);
......@@ -187,7 +203,16 @@ void pqAnimationTimeWidget::timeLineEditChanged()
{
auto& ui = this->Internals->Ui;
const auto currentValue = ui.timeValue->text().toDouble();
ui.timeValue->setProperty("PQ_DOUBLE_VALUE", QVariant(currentValue));
this->setTimeValue(currentValue);
emit this->timeValueChanged();
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::timeComboBoxChanged()
{
auto& ui = this->Internals->Ui;
const auto currentValue = ui.timeValueComboBox->currentData().toDouble();
this->setTimeValue(currentValue);
emit this->timeValueChanged();
}
......@@ -195,6 +220,8 @@ void pqAnimationTimeWidget::timeLineEditChanged()
void pqAnimationTimeWidget::setTimePrecision(int val)
{
this->Internals->Precision = val;
this->setTimeValue(this->timeValue());
this->repopulateTimeComboBox();
}
//-----------------------------------------------------------------------------
......@@ -203,6 +230,24 @@ int pqAnimationTimeWidget::timePrecision() const
return this->Internals->Precision;
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::setTimeNotation(const QChar& notation)
{
QString possibilities = QString("eEfgG");
if (possibilities.contains(notation) && this->Internals->TimeNotation != notation)
{
this->Internals->TimeNotation = notation;
this->setTimeValue(this->timeValue());
this->repopulateTimeComboBox();
}
}
//-----------------------------------------------------------------------------
QChar pqAnimationTimeWidget::timeNotation() const
{
return this->Internals->TimeNotation;
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::setTimeStepCount(int value)
{
......@@ -219,6 +264,7 @@ void pqAnimationTimeWidget::setTimeStepCount(int value)
vtkSMTimeKeeperProxy::GetLowerBoundTimeStepIndex(this->timeKeeper(), this->timeValue()));
ui.timestepValue->blockSignals(prev);
this->repopulateTimeComboBox();
this->updateTimestepCountLabelVisibility();
}
......@@ -236,10 +282,14 @@ void pqAnimationTimeWidget::setPlayMode(const QString& value)
if (value == "Sequence" || value == "Real Time")
{
ui.radioButtonValue->setChecked(true);
ui.timeValueComboBox->setVisible(false);
ui.timeValue->setVisible(true);
}
else if (value == "Snap To TimeSteps")
{
ui.radioButtonStep->setChecked(true);
ui.timeValueComboBox->setVisible(true);
ui.timeValue->setVisible(false);
}
this->updateTimestepCountLabelVisibility();
}
......@@ -300,3 +350,35 @@ bool pqAnimationTimeWidget::playModeReadOnly() const
Ui::AnimationTimeWidget& ui = this->Internals->Ui;
return !ui.radioButtonStep->isVisible();
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::repopulateTimeComboBox()
{
if (this->timeKeeper() == nullptr)
{
return;
}
double currentTimeValue = this->timeValue();
Ui::AnimationTimeWidget& ui = this->Internals->Ui;
vtkSMPropertyHelper helper(this->timeKeeper(), "TimestepValues");
bool prev = ui.timeValueComboBox->blockSignals(true);
ui.timeValueComboBox->clear();
for (unsigned int index = 0; index < helper.GetNumberOfElements(); index++)
{
QString textValue = QString::number(helper.GetAsDouble(index),
this->Internals->TimeNotation.toLatin1(), this->Internals->Precision);
ui.timeValueComboBox->addItem(textValue, helper.GetAsDouble(index));
}
ui.timeValueComboBox->blockSignals(prev);
this->setTimeValue(currentTimeValue);
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::timeRadioButtonToggled()
{
this->setPlayMode(this->playMode());
emit this->playModeChanged();
}
......@@ -86,6 +86,12 @@ public:
void setTimePrecision(int val);
int timePrecision() const;
/**
* Get/set the precision with which time is reported.
*/
void setTimeNotation(const QChar& val);
QChar timeNotation() const;
/**
* Get/set the number of timesteps.
*/
......@@ -122,6 +128,11 @@ public slots:
*/
void setAnimationScene(vtkSMProxy* animationScene);
/**
* Clear the combobox and fill it with current time values.
*/
void repopulateTimeComboBox();
private slots:
void updateTimestepCountLabelVisibility();
......@@ -139,6 +150,19 @@ private slots:
*/
void timeLineEditChanged();
/**
* called when user changes the time value in the combobox.
* we update the internal "full precision" time value and fire
* `timeValueChanged`.
*/
void timeComboBoxChanged();
/**
* called when user toggles the radio button.
* we switch playmode and fire `playModeChanged`
*/
void timeRadioButtonToggled();
private:
Q_DISABLE_COPY(pqAnimationTimeWidget)
......
......@@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqAnimationModel.h"
#include "pqAnimationTrack.h"
#include "pqApplicationCore.h"
#include "pqCoreUtilities.h"
#include "pqPropertyLinks.h"
#include "pqPropertyLinksConnection.h"
#include "pqProxy.h"
......@@ -45,6 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkCompositeAnimationPlayer.h"
#include "vtkNew.h"
#include "vtkPVDataInformation.h"
#include "vtkPVGeneralSettings.h"
#include "vtkSMParaViewPipelineController.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMSourceProxy.h"
......@@ -273,6 +275,9 @@ pqTimeInspectorWidget::pqTimeInspectorWidget(QWidget* parentObject)
this->connect(
&pqActiveObjects::instance(), SIGNAL(serverChanged(pqServer*)), SLOT(setServer(pqServer*)));
this->setServer(pqActiveObjects::instance().activeServer());
pqCoreUtilities::connect(vtkPVGeneralSettings::GetInstance(), vtkCommand::ModifiedEvent, this,
SLOT(generalSettingsChanged()));
}
//-----------------------------------------------------------------------------
......@@ -449,6 +454,8 @@ void pqTimeInspectorWidget::setSceneTimeSteps(const QList<QVariant>& val)
{
animationModel->setTickMarks(0, NULL);
}
this->generalSettingsChanged();
}
//-----------------------------------------------------------------------------
......@@ -617,3 +624,14 @@ void pqTimeInspectorWidget::handleProxyNameChanged(pqServerManagerModelItem* ite
}
}
}
//-----------------------------------------------------------------------------
void pqTimeInspectorWidget::generalSettingsChanged()
{
int timePrecision = vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision();
this->Internals->Ui.AnimationTimeWidget->setTimePrecision(timePrecision);
this->Internals->Ui.AnimationWidget->animationModel()->setTimePrecision(timePrecision);
char timeNotation = vtkPVGeneralSettings::GetInstance()->GetAnimationTimeNotation();
this->Internals->Ui.AnimationTimeWidget->setTimeNotation(timeNotation);
this->Internals->Ui.AnimationWidget->animationModel()->setTimeNotation(timeNotation);
}
......@@ -164,6 +164,8 @@ private slots:
*/
void toggleTrackSuppression(pqAnimationTrack*);
void generalSettingsChanged();
signals:
void dummySignal();
void sceneCurrentTimeChanged();
......
......@@ -59,6 +59,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqAnimationWidget.h"
#include "pqApplicationCore.h"
#include "pqComboBoxDomain.h"
#include "pqCoreUtilities.h"
#include "pqKeyFrameEditor.h"
#include "pqOrbitCreatorDialog.h"
#include "pqPipelineTimeKeyFrameEditor.h"
......@@ -74,6 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkCamera.h"
#include "vtkPVConfig.h"
#include "vtkPVGeneralSettings.h"
#include "vtkSMProperty.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxy.h"
......@@ -341,6 +343,14 @@ pqAnimationViewWidget::pqAnimationViewWidget(QWidget* _parent)
this->Internal->AnimationWidget = new pqAnimationWidget(this) << pqSetName("pqAnimationWidget");
this->Internal->AnimationWidget->animationModel()->setInteractive(true);
this->Internal->AnimationWidget->animationModel()->setTimePrecision(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision());
this->Internal->AnimationWidget->animationModel()->setTimeNotation(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimeNotation());
pqCoreUtilities::connect(vtkPVGeneralSettings::GetInstance(), vtkCommand::ModifiedEvent, this,
SLOT(generalSettingsChanged()));
QWidget* w = this->Internal->AnimationWidget->createDeleteWidget();
this->Internal->CreateSource = new pqAnimatableProxyComboBox(w) << pqSetName("ProxyCombo");
......@@ -1072,3 +1082,12 @@ void pqAnimationViewWidget::changeDataProxyDialogAccepted()
this->Internal->SelectedCueProxy->UpdateVTKObjects();
}
}
//-----------------------------------------------------------------------------
void pqAnimationViewWidget::generalSettingsChanged()
{
this->Internal->AnimationWidget->animationModel()->setTimePrecision(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision());
this->Internal->AnimationWidget->animationModel()->setTimeNotation(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimeNotation());
}
......@@ -132,6 +132,8 @@ protected slots:
// when configuring the follow-data animation
void changeDataProxyDialogAccepted();
void generalSettingsChanged();
private:
Q_DISABLE_COPY(pqAnimationViewWidget)
......
......@@ -58,11 +58,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSmartPointer.h"
#include "vtkTimerLog.h"
#include "vtkPVGeneralSettings.h"
// ParaView widget includes
// ParaView core includes
#include "pqActiveObjects.h"
#include "pqCompositeDataInformationTreeModel.h"
#include "pqCoreUtilities.h"
#include "pqNonEditableStyledItemDelegate.h"
#include "pqObjectBuilder.h"
#include "pqOutputPort.h"
......@@ -105,6 +108,9 @@ pqProxyInformationWidget::pqProxyInformationWidget(QWidget* p)
this->connect(&pqActiveObjects::instance(), SIGNAL(portChanged(pqOutputPort*)), this,
SLOT(setOutputPort(pqOutputPort*)));
pqCoreUtilities::connect(vtkPVGeneralSettings::GetInstance(), vtkCommand::ModifiedEvent, this,
SLOT(updateInformation()));
}
//-----------------------------------------------------------------------------
......@@ -242,6 +248,10 @@ void pqProxyInformationWidget::updateInformation()
pModel->blockSignals(true);
this->Ui->timeValues->blockSignals(true);
//
int precision = vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision();
char notation = vtkPVGeneralSettings::GetInstance()->GetAnimationTimeNotation();
if (tsv)
{
unsigned int numElems = tsv->GetNumberOfElements();
......@@ -249,8 +259,8 @@ void pqProxyInformationWidget::updateInformation()
{
QTreeWidgetItem* item = new QTreeWidgetItem(this->Ui->timeValues);
item->setData(0, Qt::DisplayRole, i);
item->setData(1, Qt::DisplayRole, QString::number(tsv->GetElement(i), 'g', 17));
item->setData(1, Qt::ToolTipRole, QString::number(tsv->GetElement(i), 'g', 17));
item->setData(1, Qt::DisplayRole, QString::number(tsv->GetElement(i), notation, precision));
item->setData(1, Qt::ToolTipRole, QString::number(tsv->GetElement(i), notation, precision));
item->setFlags(item->flags() | Qt::ItemIsEditable);
}
}
......
......@@ -42,6 +42,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqAnimationTrack.h"
#include "pqCheckBoxPixMaps.h"
#include <iostream>
pqAnimationModel::pqAnimationModel(QGraphicsView* p)
: QGraphicsScene(QRectF(0, 0, 400, 16 * 6), p)
, Mode(Real)
......@@ -56,6 +58,8 @@ pqAnimationModel::pqAnimationModel(QGraphicsView* p)
, CurrentKeyFrameGrabbed(NULL)
, CurrentKeyFrameEdge(0)
, EnabledHeaderToolTip("Enable/Disable Track")
, TimePrecision(6)
, TimeNotation('g')
{
QObject::connect(this, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(resizeTracks()));
p->installEventFilter(this);
......@@ -349,18 +353,20 @@ void pqAnimationModel::drawForeground(QPainter* painter, const QRectF&)
double w = labelRect.width() / num;
painter->drawText(QRectF(labelRect.left(), labelRect.top(), w / 2.0, rh),
Qt::AlignLeft | Qt::AlignVCenter, QString("%1").arg(this->StartTime, 5, 'e', 3));
Qt::AlignLeft | Qt::AlignVCenter,
QString::number(this->StartTime, this->TimeNotation.toLatin1(), this->TimePrecision));
for (int i = 1; i < num; i++)
{
double time = this->StartTime + (this->EndTime - this->StartTime) * (double)i / (double)num;
double left = labelRect.left() + w / 2.0 + w * (i - 1);
painter->drawText(
QRectF(left, labelRect.top(), w, rh), Qt::AlignCenter, QString("%1").arg(time, 5, 'e', 3));
painter->drawText(QRectF(left, labelRect.top(), w, rh), Qt::AlignCenter,
QString::number(time, this->TimeNotation.toLatin1(), this->TimePrecision));