Filer
|
The CombinedIconCreator class is responsible for creating combined icons by overlaying a document icon and an application icon. More...
#include <CombinedIconCreator.h>
Public Member Functions | |
QIcon | createCombinedIcon (const QIcon &applicationIcon) const |
The CombinedIconCreator class is responsible for creating combined icons by overlaying a document icon and an application icon.
This class provides two main functionalities:
The dominant color of the application icon is calculated by analyzing the pixel colors of the given QPixmap. The findDominantColor() function scans through the image, identifies vibrant colors, and determines the color that appears most frequently as the dominant color. If the dominant color is either very dark (lightness < 10) or very light (lightness > 220), a neutral gray color is returned instead.
The createCombinedIcon() function takes two QIcons, representing the document and application icons, and creates a new QIcon by combining them, using the dominant color to make it more distinct.
Example usage:
CombinedIconCreator iconCreator; QIcon combinedIcon = iconCreator.createCombinedIcon(documentIcon, applicationIcon);