did you try something like this?
main.cpp
...
int main(int argc, char **argv)
{
EditCustomerImageDialog ecid;
ecid.show();
NULL, tr("Open face image"), "",
tr("Image Files (*.jpg)")));
ecid.openFile(fileName);
return app.exec();
}
...
int main(int argc, char **argv)
{
QApplication app(argc, argv);
EditCustomerImageDialog ecid;
ecid.show();
const QString fileName(QFileDialog::getOpenFileName(
NULL, tr("Open face image"), "",
tr("Image Files (*.jpg)")));
ecid.openFile(fileName);
return app.exec();
}
To copy to clipboard, switch view to plain text mode
EditCustomerImageDialog.cpp
class EditCustomerImageDialog
: public QDialog{
Q_OBJECT
public:
EditCustomerImageDialog
(Customer
* c,
QWidget * parent
= 0, Qt
::WindowFlags f
= 0) {
//...
//openFile();
}
public slots:
{
if (tmpFileName.isEmpty())
NULL, tr("Open face image"), "",
tr("Image Files (*.jpg)"));
//...
}
}
class EditCustomerImageDialog : public QDialog
{
Q_OBJECT
public:
EditCustomerImageDialog(Customer * c, QWidget * parent = 0, Qt::WindowFlags f = 0)
: QDialog(parent, f)
{
//...
//openFile();
}
public slots:
void openFile(const QString &fileName = QString())
{
QString tmpFileName = fileName;
if (tmpFileName.isEmpty())
tmpFileName = QFileDialog::getOpenFileName(
NULL, tr("Open face image"), "",
tr("Image Files (*.jpg)"));
//...
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks