viewertexteditor: implement toggle for transparent clone

This commit is contained in:
itsmattkc
2022-08-25 10:25:30 -07:00
parent 541706e55e
commit 489bc97e7d
+8 -3
View File
@@ -125,9 +125,6 @@ void ViewerTextEditor::Paint(QPainter *p, Qt::Alignment valign)
ctx.selections.append(selection); ctx.selections.append(selection);
} }
if (transparent_clone_) {
transparent_clone_->documentLayout()->draw(p, ctx);
switch (valign) { switch (valign) {
case Qt::AlignTop: case Qt::AlignTop:
// Do nothing // Do nothing
@@ -139,6 +136,13 @@ void ViewerTextEditor::Paint(QPainter *p, Qt::Alignment valign)
p->translate(0, clip.height()-document()->size().height()); p->translate(0, clip.height()-document()->size().height());
break; break;
} }
const bool use_transparent_clone = true;
if (transparent_clone_ && use_transparent_clone) {
transparent_clone_->documentLayout()->draw(p, ctx);
} else {
document()->documentLayout()->draw(p, ctx);
}
} }
void ViewerTextEditor::paintEvent(QPaintEvent *e) void ViewerTextEditor::paintEvent(QPaintEvent *e)
@@ -309,6 +313,7 @@ void ViewerTextEditor::DocumentChanged()
delete transparent_clone_; delete transparent_clone_;
transparent_clone_ = document()->clone(this); transparent_clone_ = document()->clone(this);
transparent_clone_->documentLayout()->setPaintDevice(&dpi_force_); transparent_clone_->documentLayout()->setPaintDevice(&dpi_force_);
transparent_clone_->documentLayout()->setProperty("cursorWidth", document()->documentLayout()->property("cursorWidth"));
QTextCursor cursor(transparent_clone_); QTextCursor cursor(transparent_clone_);
cursor.select(QTextCursor::Document); cursor.select(QTextCursor::Document);