Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.5.0
-
None
-
Ubuntu 22.04
Description
Applying a background colour to a QCombox will result in fading.
Let us consider this code:
CMakeLists.txt
cmake_minimum_required(VERSION 3.5) project(QCombobox LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 COMPONENTS REQUIRED Core Widgets) set(SOURCE_FILES main.cpp ) add_executable(QCombobox ${SOURCE_FILES}) target_link_libraries(QCombobox PRIVATE Qt6::Core Qt6::Widgets)
main.cpp
#include <QApplication> #include <QComboBox> int main(int argc,char*argv[]){ QApplication a(argc, argv); QComboBox b; b.addItem("a"); b.setStyleSheet("background: red;"); b.show(); return a.exec(); }
It renders as:
It not the same as the "real" red colour that I get when I click on the QComboBox:
Note: the colour is not faded if setFlat() is true