Changeset View
Changeset View
Standalone View
Standalone View
krusader/KViewer/lister.cpp
Context not available. | |||||
127 | 127 | | |||
---|---|---|---|---|---|
128 | // This is quite accurate (although not perfect) way of getting | 128 | // This is quite accurate (although not perfect) way of getting | ||
129 | // a single character width along with its surrounding space. | 129 | // a single character width along with its surrounding space. | ||
130 | #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) | ||||
131 | const float fontWidth = (fm.horizontalAdvance("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW") - fm.horizontalAdvance("W")) / 99.0; | ||||
132 | #else | ||||
130 | const float fontWidth = (fm.width("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW") - fm.width("W")) / 99.0; | 133 | const float fontWidth = (fm.width("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW") - fm.width("W")) / 99.0; | ||
134 | #endif | ||||
131 | 135 | | |||
132 | const int sizeY = contentRect.height() / fontHeight; | 136 | const int sizeY = contentRect.height() / fontHeight; | ||
133 | _pageSize = sizeY; | 137 | _pageSize = sizeY; | ||
Context not available. | |||||
2017 | 2021 | | |||
2018 | const QFontMetrics fmFixed(fixedFont); | 2022 | const QFontMetrics fmFixed(fixedFont); | ||
2019 | const int fixedFontHeight = std::max(fmFixed.height(), 1); | 2023 | const int fixedFontHeight = std::max(fmFixed.height(), 1); | ||
2024 | #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) | ||||
2025 | const int fixedFontWidth = std::max(fmFixed.horizontalAdvance("W"), 1); | ||||
2026 | #else | ||||
2020 | const int fixedFontWidth = std::max(fmFixed.width("W"), 1); | 2027 | const int fixedFontWidth = std::max(fmFixed.width("W"), 1); | ||
2028 | #endif | ||||
2021 | 2029 | | |||
2022 | const int effPageSize = drawingRect.height() - normalFontHeight - 1; | 2030 | const int effPageSize = drawingRect.height() - normalFontHeight - 1; | ||
2023 | const int rowsPerPage = std::max(effPageSize / fixedFontHeight, 1); | 2031 | const int rowsPerPage = std::max(effPageSize / fixedFontHeight, 1); | ||
Context not available. |