Skip to content

Commit

Permalink
+ fix build error, fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 9, 2013
1 parent b6a9d79 commit b035e9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Base/Quantity.cpp
Expand Up @@ -22,6 +22,7 @@

#include "PreCompiled.h"
#ifndef _PreComp_
# include <sstream>
#endif

#include <cmath>
Expand Down
29 changes: 17 additions & 12 deletions src/Gui/InputField.cpp
Expand Up @@ -22,13 +22,18 @@


#include "PreCompiled.h"
#ifndef _PreComp_
# include <QContextMenuEvent>
# include <QMenu>
#endif

#include <Base/Console.h>
#include <Base/Quantity.h>
#include <Base/Exception.h>
#include <App/Application.h>

#include "InputField.h"

using namespace Gui;
using namespace Base;

Expand All @@ -40,7 +45,7 @@ InputField::InputField ( QWidget * parent )
this->setContextMenuPolicy(Qt::DefaultContextMenu);

QObject::connect(this, SIGNAL(textChanged (QString)),
this, SLOT(newInput(QString)));
this, SLOT(newInput(QString)));
}

InputField::~InputField()
Expand All @@ -64,15 +69,15 @@ void InputField::newInput(const QString & text)
}catch(Base::Exception &e){
ErrorText = e.what();
this->setToolTip(QString::fromAscii(ErrorText.c_str()));
QPalette *palette = new QPalette();
palette->setColor(QPalette::Base,QColor(255,200,200));
setPalette(*palette);
QPalette palette;
palette.setColor(QPalette::Base,QColor(255,200,200));
setPalette(palette);
parseError(QString::fromAscii(ErrorText.c_str()));
return;
}
QPalette *palette = new QPalette();
palette->setColor(QPalette::Base,QColor(200,255,200));
setPalette(*palette);
QPalette palette;
palette.setColor(QPalette::Base,QColor(200,255,200));
setPalette(palette);
ErrorText = "";
this->setToolTip(QString::fromAscii(ErrorText.c_str()));
// signaling
Expand Down Expand Up @@ -112,16 +117,16 @@ void InputField::setParamGrpPath( const QByteArray& path )
{

_handle = App::GetApplication().GetParameterGroupByPath( path);
if(_handle.isValid())
sGroupString = path;

if (_handle.isValid())
sGroupString = (const char*)path;
}

/** Returns the widget's preferences path. */
QByteArray InputField::paramGrpPath() const
{
if(_handle.isValid())
return sGroupString.c_str();
if(_handle.isValid())
return sGroupString.c_str();
return QByteArray();
}

/// sets the field with a quantity
Expand Down

0 comments on commit b035e9c

Please sign in to comment.