summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander V. Wolf <alex.v.wolf@gmail.com>2022-03-20 17:32:17 +0700
committerAlexander V. Wolf <alex.v.wolf@gmail.com>2022-03-20 17:32:17 +0700
commitbdacdf903c9760a522434731aa8575b233421ec0 (patch)
tree1564368615efbedc5acbeb80b6803b56b3c44a87
parent96c8546da8f797e9a1104edf5ec71b22fb53cfda (diff)
Fixed bug in Meteor showers search dialog (fix #2356)
-rw-r--r--plugins/MeteorShowers/src/gui/MSSearchDialog.cpp8
-rw-r--r--plugins/MeteorShowers/src/gui/MSSearchDialog.hpp4
2 files changed, 7 insertions, 5 deletions
diff --git a/plugins/MeteorShowers/src/gui/MSSearchDialog.cpp b/plugins/MeteorShowers/src/gui/MSSearchDialog.cpp
index 5ead347207..9f69330895 100644
--- a/plugins/MeteorShowers/src/gui/MSSearchDialog.cpp
+++ b/plugins/MeteorShowers/src/gui/MSSearchDialog.cpp
@@ -142,7 +142,7 @@ void MSSearchDialog::searchEvents()
treeItem->setData(ColumnCode, Qt::UserRole, r.code);
treeItem->setData(ColumnName, Qt::UserRole, r.name);
treeItem->setData(ColumnDataType, Qt::UserRole, r.type);
- treeItem->setData(ColumnPeak, Qt::UserRole, r.peak.dayOfYear());
+ treeItem->setData(ColumnPeak, Qt::UserRole, r.peak.toJulianDay());
treeItem->setData(ColumnZHR, Qt::UserRole, r.zhrMax);
}
@@ -163,9 +163,9 @@ void MSSearchDialog::selectEvent(const QModelIndex &modelIndex)
m_mgr->setEnablePlugin(true);
// Change date
- StelCore *core = StelApp::getInstance().getCore();
- QDate peak = modelIndex.sibling(modelIndex.row(), ColumnPeak).data(Qt::UserRole).toDate();
- core->setJD(peak.toJulianDay());
+ StelCore *core = StelApp::getInstance().getCore();
+ double JD = modelIndex.sibling(modelIndex.row(), ColumnPeak).data(Qt::UserRole).toDouble();
+ core->setJD(JD - core->getUTCOffset(JD)/24.);
// Find the object
QString nameI18n = modelIndex.sibling(modelIndex.row(), ColumnName).data().toString();
diff --git a/plugins/MeteorShowers/src/gui/MSSearchDialog.hpp b/plugins/MeteorShowers/src/gui/MSSearchDialog.hpp
index 26e39a9e29..5571d40fb4 100644
--- a/plugins/MeteorShowers/src/gui/MSSearchDialog.hpp
+++ b/plugins/MeteorShowers/src/gui/MSSearchDialog.hpp
@@ -98,8 +98,10 @@ private:
{
const int column = treeWidget()->sortColumn();
- if (column == MSSearchDialog::ColumnZHR || column == MSSearchDialog::ColumnPeak)
+ if (column == MSSearchDialog::ColumnZHR)
return this->data(column, Qt::UserRole).toInt() < other.data(column, Qt::UserRole).toInt();
+ else if (column == MSSearchDialog::ColumnPeak)
+ return this->data(column, Qt::UserRole).toDouble() < other.data(column, Qt::UserRole).toDouble();
else
return text(column).toLower() < other.text(column).toLower();
}