##// END OF EJS Templates
Fix bug time precision with catalogue
perrinel -
r1369:b20dcec1c57b
parent child
Show More
@@ -5,6 +5,10
5 5
6 6 #include <QDateTime>
7 7
8 /// Format for datetimes
9 const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz");
10 const auto DATETIME_FORMAT_ONE_LINE = QStringLiteral("dd/MM/yyyy hh:mm:ss:zzz");
11
8 12 /**
9 13 * Utility class with methods for dates
10 14 */
@@ -52,9 +52,6 const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{
52 52 {UNIT_COLUMN, {QObject::tr("Unit")}}, {MISSION_COLUMN, {QObject::tr("Mission")}},
53 53 {PLUGIN_COLUMN, {QObject::tr("Plugin")}}};
54 54
55 /// Format for datetimes
56 const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz");
57
58 55 QString uniqueName(const QString &defaultName,
59 56 const std::vector<std::shared_ptr<Variable> > &variables)
60 57 {
@@ -48,11 +48,15 struct CatalogueEventsModel::CatalogueEventsModelPrivate {
48 48 case CatalogueEventsModel::Column::Name:
49 49 return event->getName();
50 50 case CatalogueEventsModel::Column::TStart:
51 return nbEventProducts(event) > 0 ? DateUtils::dateTime(event->getTStart())
52 : QVariant{};
51 return nbEventProducts(event) > 0
52 ? DateUtils::dateTime(event->getTStart())
53 .toString(DATETIME_FORMAT_ONE_LINE)
54 : QVariant{};
53 55 case CatalogueEventsModel::Column::TEnd:
54 return nbEventProducts(event) > 0 ? DateUtils::dateTime(event->getTEnd())
55 : QVariant{};
56 return nbEventProducts(event) > 0
57 ? DateUtils::dateTime(event->getTEnd())
58 .toString(DATETIME_FORMAT_ONE_LINE)
59 : QVariant{};
56 60 case CatalogueEventsModel::Column::Product: {
57 61 auto eventProducts = event->getEventProducts();
58 62 QStringList eventProductList;
@@ -105,9 +109,11 struct CatalogueEventsModel::CatalogueEventsModelPrivate {
105 109 case CatalogueEventsModel::Column::Name:
106 110 return eventProduct->getProductId();
107 111 case CatalogueEventsModel::Column::TStart:
108 return DateUtils::dateTime(eventProduct->getTStart());
112 return DateUtils::dateTime(eventProduct->getTStart())
113 .toString(DATETIME_FORMAT_ONE_LINE);
109 114 case CatalogueEventsModel::Column::TEnd:
110 return DateUtils::dateTime(eventProduct->getTEnd());
115 return DateUtils::dateTime(eventProduct->getTEnd())
116 .toString(DATETIME_FORMAT_ONE_LINE);
111 117 case CatalogueEventsModel::Column::Product:
112 118 return eventProduct->getProductId();
113 119 case CatalogueEventsModel::Column::Tags:
@@ -355,6 +355,7 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
355 355 ui->treeView->setDragDropMode(QAbstractItemView::DragDrop);
356 356 ui->treeView->setDragEnabled(true);
357 357
358
358 359 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
359 360 if (checked) {
360 361 ui->btnChart->setChecked(false);
@@ -453,6 +454,10 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
453 454 QHeaderView::Interactive);
454 455 ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation,
455 456 VALIDATION_COLUMN_SIZE);
457 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TStart,
458 QHeaderView::ResizeToContents);
459 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TEnd,
460 QHeaderView::ResizeToContents);
456 461 ui->treeView->header()->setSortIndicatorShown(true);
457 462
458 463 connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() {
@@ -28,6 +28,9 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
28 28
29 29 impl->connectCatalogueUpdateSignals(this, ui);
30 30 impl->connectEventUpdateSignals(this, ui);
31
32 ui->dateTimeEventTStart->setDisplayFormat(DATETIME_FORMAT);
33 ui->dateTimeEventTEnd->setDisplayFormat(DATETIME_FORMAT);
31 34 }
32 35
33 36 CatalogueInspectorWidget::~CatalogueInspectorWidget()
@@ -13,8 +13,6 Q_LOGGING_CATEGORY(LOG_AxisRenderingUtils, "AxisRenderingUtils")
13 13
14 14 namespace {
15 15
16 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz");
17
18 16 /// Format for datetimes on a axis
19 17 const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss");
20 18
@@ -4,7 +4,7
4 4 #include "Common/DateUtils.h"
5 5 #include "Visualization/VisualizationSelectionZoneItem.h"
6 6
7 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss");
7 const auto DATETIME_FORMAT_S = QStringLiteral("yyyy/MM/dd hh:mm:ss");
8 8
9 9 struct VisualizationMultiZoneSelectionDialog::VisualizationMultiZoneSelectionDialogPrivate {
10 10 QVector<VisualizationSelectionZoneItem *> m_Zones;
@@ -46,9 +46,9 void VisualizationMultiZoneSelectionDialog::setZones(
46 46 }
47 47
48 48 auto range = zone->range();
49 name += DateUtils::dateTime(range.m_TStart).toString(DATETIME_FORMAT);
49 name += DateUtils::dateTime(range.m_TStart).toString(DATETIME_FORMAT_S);
50 50 name += " - ";
51 name += DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT);
51 name += DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT_S);
52 52
53 53 auto item = new QListWidgetItem(name, ui->listWidget);
54 54 item->setSelected(zone->selected());
@@ -139,7 +139,6
139 139 </widget>
140 140 <resources>
141 141 <include location="../../resources/sqpguiresources.qrc"/>
142 <include location="../../resources/sqpguiresources.qrc"/>
143 142 </resources>
144 143 <connections/>
145 144 </ui>
General Comments 0
You need to be logged in to leave comments. Login now