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. QWinWidget display to display Qt widget on MFC window

QWinWidget display to display Qt widget on MFC window

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 707 Views
  • 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.
  • E Offline
    E Offline
    EmmanuelC
    wrote on last edited by aha_1980
    #1

    Hello,
    I'm trying to display a Qt widget (a QLineEdit to be precise) in a MFC window. To do so, I'm using QWinWidget.

    It displays well the QLineEdit, but the problem I have is that when I want to update the field and click on it, it's disappearing...
    Then when I click on another window in my application, it's reapprearing, and is well updated if I changed the text inside of it (even if it had disappeared)
    Anyone has an idea on what's going wrong here?

    Here is my code :

    		CRect ControlArea2;
    		m_Control3.GetClientRect(ControlArea2);
    		HWND hWnd_TransfFunction = m_Control3.GetSafeHwnd();
    		QWinWidget w(hWnd_TransfFunction, 0, 0);
    		QWidget *widget = new QWidget(&w);
    		QHBoxLayout *hbox = new QHBoxLayout(widget);
    		QLabel *label = new QLabel("Enter text:", widget);
    		QLineEdit *edit = new QLineEdit(widget);
    		hbox->addWidget(label);
    		hbox->addWidget(edit);
    		widget->move(0, 0);
    		widget->setBackgroundRole(QPalette::Base);
    		w.setGeometry(ControlArea2.left, ControlArea2.top, ControlArea2.Width(), ControlArea2.Height());
    		w.setFixedSize(ControlArea2.Width(), ControlArea2.Height());
    		w.show();
    
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      What Qt version are you using?
      QtWinMigrate might have issue in Qt5+

      E 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        What Qt version are you using?
        QtWinMigrate might have issue in Qt5+

        E Offline
        E Offline
        EmmanuelC
        wrote on last edited by
        #3

        @mrjj I am using Qt 5.12.3. So it might be the problem?
        Do you think I should try an older version like Qt 5.8?

        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