* @brief Computes the inner plot rectangle after reserving axis-label margins. */
| 847 | * @brief Computes the inner plot rectangle after reserving axis-label margins. |
| 848 | */ |
| 849 | QRectF Widgets::Waterfall::computePlotRect(const QFontMetrics& fm) const |
| 850 | { |
| 851 | if (!m_axisVisible || width() < kMinAxisWidth || height() < kMinAxisHeight) |
| 852 | return QRectF(0.5, 0.5, qMax(0.0, width() - 1), qMax(0.0, height() - 1)); |
| 853 | |
| 854 | static auto& fonts = Misc::CommonFonts::instance(); |
| 855 | const QFontMetrics titleFm(fonts.widgetFont(0.91, true)); |
| 856 | |
| 857 | const int yTickWidth = |
| 858 | fm.horizontalAdvance(QStringLiteral("00.00")) + kAxisTickPx + kAxisLabelPad; |
| 859 | const int yTitleWidth = titleFm.height() + 2; |
| 860 | |
| 861 | const int leftMargin = yTitleWidth + yTickWidth; |
| 862 | const int rightMargin = kAxisLabelPad; |
| 863 | const int topMargin = kAxisLabelPad; |
| 864 | const int bottomMargin = fm.height() + kAxisTickPx + kAxisLabelPad * 2; |
| 865 | |
| 866 | return QRectF(leftMargin + 0.5, |
| 867 | topMargin + 0.5, |
| 868 | qMax(0.0, width() - leftMargin - rightMargin - 1), |
| 869 | qMax(0.0, height() - topMargin - bottomMargin - 1)); |
| 870 | } |
| 871 | |
| 872 | /** |
| 873 | * @brief Draws the ring-buffered history: the visible logical rows map to at most two |
nothing calls this directly
no test coverage detected