Numeric keypad spans the full keyboard height

- Sections take "fillHeight": their rows stretch over the whole key area
  instead of sitting at the bottom at the shared row height
- Rows of other blocks are unaffected; the template turns it on for the numpad

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 22:31:42 +02:00
co-authored by Claude Opus 5.5
parent 2e418bd1f7
commit 75bbe2e566
8 changed files with 49 additions and 22 deletions
+9 -6
View File
@@ -12,22 +12,25 @@ struct KeyboardMetrics {
};
// The keys on screen: blocks of rows, side by side.
using Block = QList<Row>;
struct Block {
QList<Row> rows;
bool fillHeight = false; // rows grow to span the full height instead of sharing the row height
};
// Lays out blocks to fill `size`. Returns one rect per key, block by block in
// row order (spacers included). One key unit has the same width everywhere;
// all rows share one height, and shorter blocks sit at the bottom. In each
// block, stretch keys grow to make their row as wide as the widest one, and
// remaining shorter rows are centered.
// rows share one height, set by the tallest block that doesn't fill, and
// shorter blocks sit at the bottom. In each block, stretch keys grow to make
// their row as wide as the widest one, and remaining shorter rows are centered.
QList<QRectF> computeKeyRects(const QList<Block> &blocks, QSizeF size, KeyboardMetrics metrics = {});
inline QList<QRectF> computeKeyRects(const Layer &layer, QSizeF size, KeyboardMetrics metrics = {})
{
return computeKeyRects({layer.rows}, size, metrics);
return computeKeyRects({{layer.rows}}, size, metrics);
}
// Total width of a row in key units, before stretching.
qreal rowUnits(const Row &row);
// Width of all blocks in key units, ignoring gaps.
qreal totalUnits(const QList<Block> &blocks);
// Rows of the tallest block.
// Rows of the tallest block that sets the row height (see computeKeyRects).
qsizetype totalRows(const QList<Block> &blocks);