Lycus HackerEmo
17th January 2010, 01:32
Hello good request a little help is that I'm trying to create a database application with the driver qmysql in which I need to save data with all employees and photo (in the same database) for reasons that everything is going to centralize on a remote server and I've searched on google and come in php examples but someone has knowledge about the topic who can give me a help?.
What they do is the following routines:
************************************************** ***********************************
1 .- capture the image with a digital camera and copied the hard drive.
2 .- Through a QFileDialog locate the picture, save your route and name in a call QString archivo_foto
3 .- a QLabel I put in the value setPixmap the path and filename of the image and choose the shows QFileDialog
the picture on the label.
int MainWindow::captura()
{
QString archivo_foto;
archivo_foto = QFileDialog::getOpenFileName(this,tr("Abrir Archivo"),tr("/home/Imágenes"),tr("Imagenes(*.png *.xpm *.jpg"));
ui->label_foto->setPixmap(archivo_foto);
return 0;
}
But the problem comes when I save the query where I add the second field of this VALUES
ui-> label_foto-> pixmap () does not know if I miss something or have to convert that into the database field I put as LONGBLOB
QSqlQuery query;
query.exec("INSERT INTO `ismed`.`empleados` (`id` ,`foto`,`nombre` ,`apellidop` ,`apellidom` ,`puesto` ,`direccion` ,`fecha_ingreso` ,`salario` ,`depto` ,`activo`)VALUES (NULL ,"+ ui->label_foto->pixmap() +",'"+ui->lineEdit_2->text()+"', '"+ui->lineEdit_3->text()+"', '"+ui->lineEdit_4->text()+"', '"+ui->lineEdit_5->text()+"', '"+ui->lineEdit_6->text()+"', '"+ui->lineEdit_7->text()+"', '"+ui->lineEdit_8->text()+"', '"+ui->lineEdit_9->text()+"', '"+ui->lineEdit_10->text()+"');");
I mark the following error:
/home/horus/sql/mainwindow.cpp:56: error: invalid operands of types ‘const char [167]’ and ‘const QPixmap*’ to binary ‘operator+’
thank you very much for your help
What they do is the following routines:
************************************************** ***********************************
1 .- capture the image with a digital camera and copied the hard drive.
2 .- Through a QFileDialog locate the picture, save your route and name in a call QString archivo_foto
3 .- a QLabel I put in the value setPixmap the path and filename of the image and choose the shows QFileDialog
the picture on the label.
int MainWindow::captura()
{
QString archivo_foto;
archivo_foto = QFileDialog::getOpenFileName(this,tr("Abrir Archivo"),tr("/home/Imágenes"),tr("Imagenes(*.png *.xpm *.jpg"));
ui->label_foto->setPixmap(archivo_foto);
return 0;
}
But the problem comes when I save the query where I add the second field of this VALUES
ui-> label_foto-> pixmap () does not know if I miss something or have to convert that into the database field I put as LONGBLOB
QSqlQuery query;
query.exec("INSERT INTO `ismed`.`empleados` (`id` ,`foto`,`nombre` ,`apellidop` ,`apellidom` ,`puesto` ,`direccion` ,`fecha_ingreso` ,`salario` ,`depto` ,`activo`)VALUES (NULL ,"+ ui->label_foto->pixmap() +",'"+ui->lineEdit_2->text()+"', '"+ui->lineEdit_3->text()+"', '"+ui->lineEdit_4->text()+"', '"+ui->lineEdit_5->text()+"', '"+ui->lineEdit_6->text()+"', '"+ui->lineEdit_7->text()+"', '"+ui->lineEdit_8->text()+"', '"+ui->lineEdit_9->text()+"', '"+ui->lineEdit_10->text()+"');");
I mark the following error:
/home/horus/sql/mainwindow.cpp:56: error: invalid operands of types ‘const char [167]’ and ‘const QPixmap*’ to binary ‘operator+’
thank you very much for your help