Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0
-
None
Description
procedure QApplication::palette(const QWidget* w) uses two steps to find palette for given object:
1) if classname of given object is found in hash then return found palette
2) if hash doesn't contain key with value "classname of given object" then procedure tries to find FIRST element of hash which can be used as base class of classname of given object.
There is error in second step of algorithm. Hash uses its own order of elements. It is wrong to use FIRST FOUND element.
Let's see to example.
We added many elements to palette hash. Two of them is palettes for QFrame and QTreeView.
We have class "Tree" inherited from "QTreeView".
If we find palette element for class "Tree" we will not found this name in keys of hash. And we will use second step of search algorithm. And depending on the number of objects inserted in hash and their names we can find elements "QFrame" or "QTreeView". And no one can guarantee that we will find QTreeView.
This is situation from my real project. I spent about 2 hours to localize problem. I checked it in Qt 4.3.2 and today i found same situation in Qt 4.6.0.