forked from qt-creator/qt-creator
Help/litehtml: Fix selection drawing for CMake documentation
Don't rely on litehtml calling draw_background for the root element. Manually draw selections first, then let litehtml draw as before. Change-Id: Ic9efd11b564dec1742aa6b6ffcb58133504681ff Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -652,11 +652,9 @@ void DocumentContainer::buildIndex()
|
||||
|
||||
void DocumentContainer::draw_background(litehtml::uint_ptr hdc, const litehtml::background_paint &bg)
|
||||
{
|
||||
// TODO
|
||||
auto painter = toQPainter(hdc);
|
||||
if (bg.is_root) {
|
||||
// TODO ?
|
||||
drawSelection(painter, toQRect(bg.border_box));
|
||||
return;
|
||||
}
|
||||
painter->save();
|
||||
@@ -935,6 +933,14 @@ void DocumentContainer::render(int width, int height)
|
||||
m_selection.update();
|
||||
}
|
||||
|
||||
void DocumentContainer::draw(QPainter *painter, const QRect &clip)
|
||||
{
|
||||
drawSelection(painter, clip);
|
||||
const QPoint pos = -m_scrollPosition;
|
||||
const litehtml::position clipRect = {clip.x(), clip.y(), clip.width(), clip.height()};
|
||||
document()->draw(reinterpret_cast<litehtml::uint_ptr>(painter), pos.x(), pos.y(), &clipRect);
|
||||
}
|
||||
|
||||
QVector<QRect> DocumentContainer::mousePressEvent(const QPoint &documentPos,
|
||||
const QPoint &viewportPos,
|
||||
Qt::MouseButton button)
|
||||
|
||||
Reference in New Issue
Block a user