Transparency when using Qt in MFC application
-
wrote on 26 Sept 2014, 14:19 last edited by
Hi All,
I'm new to Qt and so far it has been an incredible experience!! super easy and clean!
I'm struggling to get the transparency right for the control I'm developing within an existing MFC app.
I'm trying to create a semi-transparent control on an existing mfc app.
Here is the code that I'm using :@ QWinWidget *w = new QWinWidget(m_parent, 0, 0);
//w->move(10,200);
w->setGeometry(QRect(10, 200, 200, 160));
w->setVisible(true);
w->setWindowOpacity( 0.5 );//GroupBox m_qt_groupBox = new QGroupBox(w); m_qt_groupBox->setObjectName(QStringLiteral("QTGroupBox")); m_qt_groupBox->setTitle(QStringLiteral("QT Group Box")); m_qt_groupBox->setGeometry(QRect(1, 11, 200, 150)); //m_qt_groupBox->setStyleSheet(QStringLiteral("background-color: rgba(0, 85, 0, 20);")); m_qt_groupBox->show(); //m_qt_dial = new QDial(groupBox); //m_qt_dial->setObjectName(QStringLiteral("QT Dial Test")); //m_qt_dial->show(); //m_qt_dial->setFocus(); m_qt_dial = new QDial(m_qt_groupBox); m_qt_dial->setObjectName(QStringLiteral("dial")); m_qt_dial->setGeometry(QRect(10, 20, 121, 101)); m_qt_dial->setWrapping(false); m_qt_dial->setNotchTarget(3.7); m_qt_dial->setNotchesVisible(true); m_qt_dial->show(); m_qt_verticalSlider = new QSlider(m_qt_groupBox); m_qt_verticalSlider->setObjectName(QStringLiteral("verticalSlider")); m_qt_verticalSlider->setGeometry(QRect(130, 30, 41, 81)); m_qt_verticalSlider->setOrientation(Qt::Vertical); m_qt_verticalSlider->show();@
where m_parent is a CWnd object.
What is happening is that when I click on the QDial the QT widget goes on the top of everything else hiding all the MFC controls underneath.
!http://oi59.tinypic.com/35lyxzk.jpg()!
!http://tinypic.com/view.php?pic=t0g8q1&s=8#.VCV13PldXnQ()!
Does somebody knows what I need to do in order to get transparency working correctly ?
Thanks a lot for your help,
Ben.
-
wrote on 27 Sept 2014, 10:05 last edited by
Nobody at all had my same issue ?
Thanks a lot for the help.
1/2