Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextEdit can not redraw when its Ancestor is a native widget(use dx9 painting)?
Qt 6.11 is out! See what's new in the release blog

QTextEdit can not redraw when its Ancestor is a native widget(use dx9 painting)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wu X
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wu X
        wrote on last edited by
        #3

        @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
        
        
        1 Reply Last reply
        0
        • W Offline
          W Offline
          Wu X
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Did you check the Creating Transparent Windows documentation in the QWidget documentation ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            W 1 Reply Last reply
            0
            • SGaistS SGaist

              Did you check the Creating Transparent Windows documentation in the QWidget documentation ?

              W Offline
              W Offline
              Wu X
              wrote on last edited by
              #6

              @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.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                What are you drawing with DirectX ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved