Unsolved QTextEdit can not redraw when its Ancestor is a native widget(use dx9 painting)?
-
This post is deleted! -
Hi and welcome to devnet,
You're a bit too vague. What version of Qt ? On what version of Windows ?
If possible, you should share your implementation so other can take a look at it.
-
@SGaist said in QTextEdit can not redraw when its Ancestor is a native widget(use dx9 painting)?:
vague
Thank you for your reply.
Qt Ver = 5.6 in Win10.code likes:
//this is my m_mainView part implementation D3dWidget()D3dWidget(QWidget *parent): QWidget(parent) { setAttribute(Qt::WA_PaintOnScreen, true); setAttribute(Qt::WA_NativeWindow, true); initializeDirect3D();//Creat D3DDevice using winId() } QPaintEngine* D3dWidget::paintEngine() const { return NULL; } void D3dWidget::mouseDoubleClickEvent(QMouseEvent *event) { m_pTextEdit = new QTextEdit(this); m_pTextEdit->setStyleSheet("background-color:transparent;"); m_pTextEdit->setAcceptRichText(false); m_pTextEdit->setWordWrapMode(QTextOption::NoWrap); m_pTextEdit->setPlainText("This is a test text!"); m_pTextEdit->move(event->pos()); m_pTextEdit->resize(200,100); m_pTextEdit->show(); m_pTextEdit->setFocus(); }
and
auto m_mainView = new D3dWidget(); vlayout->addWidget(m_mainView);//the layout belong to one QScrollAreaWidget
-
oops.
may be I found the key codes.m_pTextEdit->setStyleSheet("background-color:transparent;");
when delete this code,QtextEdit works normal.
But I expect the TextEdit is transpatrent so that make user looks like edit in the view.
what can i do? -
Did you check the Creating Transparent Windows documentation in the QWidget documentation ?
-
@SGaist yes, i read it,but the documentation no mention of without QPainter.I doubt have some special mechanism when using DirectX instead of Qpainter.
-
What are you drawing with DirectX ?