src/gui/text/qtextdocumentlayout.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
  1435         layout.setCacheEnabled(true);
  1435         layout.setCacheEnabled(true);
  1436         QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute);
  1436         QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute);
  1437         option.setTextDirection(dir);
  1437         option.setTextDirection(dir);
  1438         layout.setTextOption(option);
  1438         layout.setTextOption(option);
  1439         layout.beginLayout();
  1439         layout.beginLayout();
  1440         layout.createLine();
  1440         QTextLine line = layout.createLine();
       
  1441         if (line.isValid())
       
  1442             line.setLeadingIncluded(true);
  1441         layout.endLayout();
  1443         layout.endLayout();
  1442         layout.draw(painter, QPointF(r.left(), pos.y()));
  1444         layout.draw(painter, QPointF(r.left(), pos.y()));
  1443         break;
  1445         break;
  1444     }
  1446     }
  1445     case QTextListFormat::ListSquare:
  1447     case QTextListFormat::ListSquare:
  1446         painter->fillRect(r, brush);
  1448         painter->fillRect(r, brush);
  1447         break;
  1449         break;
  1448     case QTextListFormat::ListCircle:
  1450     case QTextListFormat::ListCircle:
  1449         painter->drawEllipse(r);
  1451         painter->setPen(QPen(brush, 0));
       
  1452         painter->drawEllipse(r.translated(0.5, 0.5)); // pixel align for sharper rendering
  1450         break;
  1453         break;
  1451     case QTextListFormat::ListDisc:
  1454     case QTextListFormat::ListDisc:
  1452         painter->setBrush(brush);
  1455         painter->setBrush(brush);
  1453         painter->setPen(Qt::NoPen);
  1456         painter->setPen(Qt::NoPen);
  1454         painter->drawEllipse(r);
  1457         painter->drawEllipse(r);
  1455         painter->setBrush(Qt::NoBrush);
       
  1456         break;
  1458         break;
  1457     case QTextListFormat::ListStyleUndefined:
  1459     case QTextListFormat::ListStyleUndefined:
  1458         break;
  1460         break;
  1459     default:
  1461     default:
  1460         break;
  1462         break;
  2577         bool firstLine = true;
  2579         bool firstLine = true;
  2578         while (1) {
  2580         while (1) {
  2579             QTextLine line = tl->createLine();
  2581             QTextLine line = tl->createLine();
  2580             if (!line.isValid())
  2582             if (!line.isValid())
  2581                 break;
  2583                 break;
       
  2584             line.setLeadingIncluded(true);
  2582 
  2585 
  2583             QFixed left, right;
  2586             QFixed left, right;
  2584             floatMargins(layoutStruct->y, layoutStruct, &left, &right);
  2587             floatMargins(layoutStruct->y, layoutStruct, &left, &right);
  2585             left = qMax(left, l);
  2588             left = qMax(left, l);
  2586             right = qMin(right, r);
  2589             right = qMin(right, r);