+ fix build error, fix memory leaks

This commit is contained in:
wmayer 2013-11-09 18:57:34 +01:00
parent b6a9d7973d
commit b035e9cb0c
2 changed files with 18 additions and 12 deletions

View File

@ -22,6 +22,7 @@
#include "PreCompiled.h" #include "PreCompiled.h"
#ifndef _PreComp_ #ifndef _PreComp_
# include <sstream>
#endif #endif
#include <cmath> #include <cmath>

View File

@ -22,6 +22,10 @@
#include "PreCompiled.h" #include "PreCompiled.h"
#ifndef _PreComp_
# include <QContextMenuEvent>
# include <QMenu>
#endif
#include <Base/Console.h> #include <Base/Console.h>
#include <Base/Quantity.h> #include <Base/Quantity.h>
@ -29,6 +33,7 @@
#include <App/Application.h> #include <App/Application.h>
#include "InputField.h" #include "InputField.h"
using namespace Gui; using namespace Gui;
using namespace Base; using namespace Base;
@ -40,7 +45,7 @@ InputField::InputField ( QWidget * parent )
this->setContextMenuPolicy(Qt::DefaultContextMenu); this->setContextMenuPolicy(Qt::DefaultContextMenu);
QObject::connect(this, SIGNAL(textChanged (QString)), QObject::connect(this, SIGNAL(textChanged (QString)),
this, SLOT(newInput(QString))); this, SLOT(newInput(QString)));
} }
InputField::~InputField() InputField::~InputField()
@ -64,15 +69,15 @@ void InputField::newInput(const QString & text)
}catch(Base::Exception &e){ }catch(Base::Exception &e){
ErrorText = e.what(); ErrorText = e.what();
this->setToolTip(QString::fromAscii(ErrorText.c_str())); this->setToolTip(QString::fromAscii(ErrorText.c_str()));
QPalette *palette = new QPalette(); QPalette palette;
palette->setColor(QPalette::Base,QColor(255,200,200)); palette.setColor(QPalette::Base,QColor(255,200,200));
setPalette(*palette); setPalette(palette);
parseError(QString::fromAscii(ErrorText.c_str())); parseError(QString::fromAscii(ErrorText.c_str()));
return; return;
} }
QPalette *palette = new QPalette(); QPalette palette;
palette->setColor(QPalette::Base,QColor(200,255,200)); palette.setColor(QPalette::Base,QColor(200,255,200));
setPalette(*palette); setPalette(palette);
ErrorText = ""; ErrorText = "";
this->setToolTip(QString::fromAscii(ErrorText.c_str())); this->setToolTip(QString::fromAscii(ErrorText.c_str()));
// signaling // signaling
@ -112,16 +117,16 @@ void InputField::setParamGrpPath( const QByteArray& path )
{ {
_handle = App::GetApplication().GetParameterGroupByPath( path); _handle = App::GetApplication().GetParameterGroupByPath( path);
if(_handle.isValid()) if (_handle.isValid())
sGroupString = path; sGroupString = (const char*)path;
} }
/** Returns the widget's preferences path. */ /** Returns the widget's preferences path. */
QByteArray InputField::paramGrpPath() const QByteArray InputField::paramGrpPath() const
{ {
if(_handle.isValid()) if(_handle.isValid())
return sGroupString.c_str(); return sGroupString.c_str();
return QByteArray();
} }
/// sets the field with a quantity /// sets the field with a quantity