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. Transparency when using Qt in MFC application
Forum Update on Monday, May 27th 2025

Transparency when using Qt in MFC application

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 918 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.
  • M Offline
    M Offline
    mandragora
    wrote on 26 Sept 2014, 14:19 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mandragora
      wrote on 27 Sept 2014, 10:05 last edited by
      #2

      Nobody at all had my same issue ?

      Thanks a lot for the help.

      1 Reply Last reply
      0

      1/2

      26 Sept 2014, 14:19

      • Login

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