QComboBox cannot make dropdown window background transparent
-
I've tried everything I could to make the QComboBox window background transparent, but it just shows up black:

I am using Qt 5.12.9 on Windows 10. The QComboBox's stylesheet is
* { padding: 10px 10px 10px 10px; border-radius: 10px; }and in mainwindow.cpp in a brand new, empty Qt project (with just the combobox added and mainwindow background set to red for visibility):
ui->comboBox->setFrame(false); QFrame* window = dynamic_cast<QFrame*>(ui->comboBox->view()->window()); // this is a QComboBoxPrivateContainer, which is a subclass of QFrame window->setFrameStyle(QFrame::NoFrame); window->setStyleSheet("* { background-color: green; }"); window->setWindowFlags(Qt::FramelessWindowHint); window->setAttribute(Qt::WA_TranslucentBackground, true); window->setAttribute(Qt::WA_OpaquePaintEvent, true);Yet the window background is still black. Further, FramelessWindowHint prevents the dropdown from opening unless I press space with it focused (and after opening, it immediately closes)
How do I make the dropdown window background completely invisible for QComboBox?
-
@EchoReaper said in QComboBox cannot make dropdown window background transparent:
window->setFrameStyle(QFrame::NoFrame); window->setStyleSheet("* { background-color: green; }");add "QAbstractItemView{background:green;}" to the stylesheet of ui->comboBox .