+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: ModuleBase_Tools.cpp
// Created: 11 July 2014
// Author: Vitaly Smetannikov
#include <QLayout>
#include <QPainter>
#include <QBitmap>
+#include <QDoubleSpinBox>
namespace ModuleBase_Tools {
{
if(!theLayout)
return;
- theLayout->setContentsMargins(2, 5, 5, 2);
+ theLayout->setContentsMargins(2, 5, 2, 5);
theLayout->setSpacing(4);
}
theLayout->setSpacing(5);
}
-QPixmap composite(const QString& theAdditionalIcon, const int theXShift,
- const int theYShift, const QString& theIcon)
+QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon)
{
QImage anIcon(theIcon);
QImage anAditional(theAdditionalIcon);
int aWidth = anIcon.width();
int aHeight = anIcon.height();
- int aStartWidthPos = aWidth-anAddWidth-1;
- int aStartHeightPos = aHeight-anAddHeight-1;
+ int aStartWidthPos = aWidth - anAddWidth - 1;
+ int aStartHeightPos = aHeight - anAddHeight - 1;
- for (int i = 0; i < anAddWidth; i++)
+ for (int i = 0; i < anAddWidth && i + aStartWidthPos < aWidth; i++)
{
- for (int j = 0; j < anAddHeight; j++)
+ 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(aResult);
}
+void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
+{
+ bool isBlocked = theSpin->blockSignals(true);
+ theSpin->setValue(theValue);
+ theSpin->blockSignals(isBlocked);
+}
+
}