Changeset View
Changeset View
Standalone View
Standalone View
src/printing/printpainter.cpp
Show First 20 Lines • Show All 529 Lines • ▼ Show 20 Line(s) | 528 | painter.drawText(QRect(_marg, y, pl.pageWidth - (2 * _marg), pl.maxHeight - y), | |||
---|---|---|---|---|---|
530 | i18n("Typographical Conventions for %1", _hlName), &_r); | 530 | i18n("Typographical Conventions for %1", _hlName), &_r); | ||
531 | const int _w = pl.pageWidth - (_marg * 2) - (pl.innerMargin * 2); | 531 | const int _w = pl.pageWidth - (_marg * 2) - (pl.innerMargin * 2); | ||
532 | const int _x = _marg + pl.innerMargin; | 532 | const int _x = _marg + pl.innerMargin; | ||
533 | y += _r.height() + pl.innerMargin; | 533 | y += _r.height() + pl.innerMargin; | ||
534 | painter.drawLine(_x, y, _x + _w, y); | 534 | painter.drawLine(_x, y, _x + _w, y); | ||
535 | y += 1 + pl.innerMargin; | 535 | y += 1 + pl.innerMargin; | ||
536 | 536 | | |||
537 | int _widest(0); | 537 | int _widest(0); | ||
538 | foreach (const KTextEditor::Attribute::Ptr &attribute, _attributes) { | 538 | for (const KTextEditor::Attribute::Ptr &attribute : qAsConst(_attributes)) { | ||
539 | _widest = qMax(QFontMetrics(attribute->font()).width(attribute->name().section(QLatin1Char(':'), 1, 1)), _widest); | 539 | _widest = qMax(QFontMetrics(attribute->font()).width(attribute->name().section(QLatin1Char(':'), 1, 1)), _widest); | ||
540 | } | 540 | } | ||
541 | 541 | | |||
542 | const int _guideCols = _w / (_widest + pl.innerMargin); | 542 | const int _guideCols = _w / (_widest + pl.innerMargin); | ||
543 | 543 | | |||
544 | // draw attrib names using their styles | 544 | // draw attrib names using their styles | ||
545 | const int _cw = _w / _guideCols; | 545 | const int _cw = _w / _guideCols; | ||
546 | int _i = 0; | 546 | int _i = 0; | ||
547 | 547 | | |||
548 | _titleFont.setUnderline(true); | 548 | _titleFont.setUnderline(true); | ||
549 | QString _currentHlName; | 549 | QString _currentHlName; | ||
550 | foreach (const KTextEditor::Attribute::Ptr &attribute, _attributes) { | 550 | for (const KTextEditor::Attribute::Ptr &attribute : qAsConst(_attributes)) { | ||
551 | QString _hl = attribute->name().section(QLatin1Char(':'), 0, 0); | 551 | QString _hl = attribute->name().section(QLatin1Char(':'), 0, 0); | ||
552 | QString _name = attribute->name().section(QLatin1Char(':'), 1, 1); | 552 | QString _name = attribute->name().section(QLatin1Char(':'), 1, 1); | ||
553 | if (_hl != _hlName && _hl != _currentHlName) { | 553 | if (_hl != _hlName && _hl != _currentHlName) { | ||
554 | _currentHlName = _hl; | 554 | _currentHlName = _hl; | ||
555 | if (_i % _guideCols) { | 555 | if (_i % _guideCols) { | ||
556 | y += m_fontHeight; | 556 | y += m_fontHeight; | ||
557 | } | 557 | } | ||
558 | y += pl.innerMargin; | 558 | y += pl.innerMargin; | ||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |