* @brief Formats a time value -- integer seconds when step >= 1, decimals otherwise. */
| 1254 | * @brief Formats a time value -- integer seconds when step >= 1, decimals otherwise. |
| 1255 | */ |
| 1256 | QString Widgets::Waterfall::formatTimeTick(double seconds, double step) |
| 1257 | { |
| 1258 | if (step >= 1.0) |
| 1259 | return QString::number(std::round(seconds), 'f', 0); |
| 1260 | |
| 1261 | const int decimals = std::max(0, -static_cast<int>(std::floor(std::log10(step)))); |
| 1262 | return QString::number(seconds, 'f', decimals); |
| 1263 | } |
| 1264 | |
| 1265 | //-------------------------------------------------------------------------------------------------- |
| 1266 | // View state (zoom / pan / axis visibility) |