18 #include "PropertyButton.h"
20 #include <QFileDialog>
21 #include <QToolButton>
22 #include <QApplication>
26 #include <core/util/Utilities.h>
27 using namespace composer::core::util;
29 PropertyButtons::PropertyButtons(QString propName, QWidget *parent)
32 connect(mButton, SIGNAL(pressed()), SLOT(openfile()));
34 connect(
this, SIGNAL(lostFocus()), SLOT(emitNewValue()));
36 qDebug() <<
"PropertyButtons" << propName;
39 void PropertyButtons::openfile()
41 disconnect(
this, SIGNAL(lostFocus()),
this, SLOT(emitNewValue()));
43 dialog.setFileMode(QFileDialog::AnyFile);
45 QString filename = dialog.getOpenFileName(NULL, tr(
"Select file"),
46 Utilities::getLastFileDialogPath());
48 if(!filename.isEmpty() && !filename.isNull())
50 Utilities::updateLastFileDialogPath(filename);
55 connect(
this, SIGNAL(lostFocus()), SLOT(emitNewValue()));
58 void PropertyButtons::emitNewValue()
60 emit newValue(key, text());
63 void PropertyButtons::emitNewValue(QString text)
65 emit newValue(key, text);