QuantitySpinBox: Moved getIcon() and some data members to ExpressionBinding class.
Conflicts: src/Gui/QuantitySpinBox.cpp
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QPixmapCache>
|
||||
# include <BitmapFactory.h>
|
||||
#endif
|
||||
#include "ExpressionBinding.h"
|
||||
#include "Command.h"
|
||||
@@ -35,6 +37,8 @@ using namespace Gui;
|
||||
using namespace App;
|
||||
|
||||
ExpressionBinding::ExpressionBinding()
|
||||
: iconLabel(0)
|
||||
, iconHeight(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -104,6 +108,22 @@ std::string ExpressionBinding::getEscapedExpressionString() const
|
||||
return Base::Tools::escapedUnicodeFromUtf8(getExpressionString().c_str());
|
||||
}
|
||||
|
||||
QPixmap ExpressionBinding::getIcon(const char* name, const QSize& size) const
|
||||
{
|
||||
QString key = QString::fromAscii("%1_%2x%3")
|
||||
.arg(QString::fromAscii(name))
|
||||
.arg(size.width())
|
||||
.arg(size.height());
|
||||
QPixmap icon;
|
||||
if (QPixmapCache::find(key, icon))
|
||||
return icon;
|
||||
|
||||
icon = BitmapFactory().pixmapFromSvg(name, size);
|
||||
if (!icon.isNull())
|
||||
QPixmapCache::insert(key, icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
bool ExpressionBinding::apply(const std::string & propName)
|
||||
{
|
||||
if (hasExpression()) {
|
||||
|
||||
Reference in New Issue
Block a user