+
+void adjustMargins(QWidget* theWidget)
+{
+ if(!theWidget)
+ return;
+ adjustMargins(theWidget->layout());
+}
+
+void adjustMargins(QLayout* theLayout)
+{
+ if(!theLayout)
+ return;
+ theLayout->setContentsMargins(2, 5, 5, 2);
+ theLayout->setSpacing(4);
+}
+
+void zeroMargins(QWidget* theWidget)
+{
+ if(!theWidget)
+ return;
+ zeroMargins(theWidget->layout());
+}
+
+void zeroMargins(QLayout* theLayout)
+{
+ if(!theLayout)
+ return;
+ theLayout->setContentsMargins(0, 0, 0, 0);
+ theLayout->setSpacing(5);
+}
+
+QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon)
+{
+ QImage anIcon(theIcon);
+ QImage anAditional(theAdditionalIcon);
+
+ if (anIcon.isNull())
+ return QPixmap();
+
+ int anAddWidth = anAditional.width();
+ int anAddHeight = anAditional.height();
+
+ int aWidth = anIcon.width();
+ int aHeight = anIcon.height();
+
+ int aStartWidthPos = aWidth - anAddWidth - 1;
+ int aStartHeightPos = aHeight - anAddHeight - 1;
+
+ for (int i = 0; i < anAddWidth && i + aStartWidthPos < aWidth; i++)
+ {
+ for (int j = 0; j < anAddHeight && j + aStartHeightPos < aHeight; j++)
+ {
+ if (qAlpha(anAditional.pixel(i, j)) > 0)
+ anIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, anAditional.pixel(i, j));
+ }
+ }
+ return QPixmap::fromImage(anIcon);