Hallo,
ich frage mich warum ich bei image.save() kein QString als bildformat übergeben darf?
Ich weiß dass in der Doku das ein const char* sein MUSS aber warum denn?
Ich MUSS unbeding einen QString in einen const char* umwandeln....schaffe das aber nicht.
Gibt es eine Lösung?
image.save() mit QString format ???
Habe ich eben vor 2 stunden gemacht...
ich paste mal den code unkommentiert....
http://dictionary.reference.com/translate/text.html
Wenn es nicht verstaendlich ist.... kannst ja nochmals freundlich fragen...
ich paste mal den code unkommentiert....
http://dictionary.reference.com/translate/text.html
Wenn es nicht verstaendlich ist.... kannst ja nochmals freundlich fragen...
Code: Alles auswählen
void Gui_Resize::SavePicimage()
{
QString saveto = fileName;
QFileInfo ImageInfo(saveto);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString ext = ImageInfo.completeSuffix();
QByteArray ba = ext.toAscii();
if (!fileName.isEmpty()) {
int large = horizontalSlider->value();
if (large > 151) {
QPixmap picsa(fileName);
QPixmap resized = picsa.scaledToWidth(large);
resized.save(saveto,ba.data(),80);
QApplication::restoreOverrideCursor();
QMessageBox::information(this, tr("Segnalazione:"), tr("Questa immagine è stata correttamente salvata.\nNon dimenticate di salvare il tutto."));
} else {
QApplication::restoreOverrideCursor();
QMessageBox::information(this, tr("Segnalazione:"), tr("Questa immagine %1 figura troppo piccola.").arg(fileName));
}
} else {
QApplication::restoreOverrideCursor();
QMessageBox::information(this, tr("Segnalazione:"), tr("Impossibile Caricare il file %1.").arg(fileName));
}
QApplication::restoreOverrideCursor();
}-
Christian81
- Beiträge: 7319
- Registriert: 26. August 2004 14:11
- Wohnort: Bremen
- Kontaktdaten:
Re: image.save() mit QString format ???
Schonmal mit latin1() / toLatin1().data() versucht??Mati hat geschrieben:Hallo,
ich frage mich warum ich bei image.save() kein QString als bildformat übergeben darf?
Ich weiß dass in der Doku das ein const char* sein MUSS aber warum denn?
Ich MUSS unbeding einen QString in einen const char* umwandeln....schaffe das aber nicht.
Gibt es eine Lösung?
MfG Christian
'Funktioniert nicht' ist keine Fehlerbeschreibung
'Funktioniert nicht' ist keine Fehlerbeschreibung
Hi, folgendes aus der Doku:
You can also pass string literals to functions that take QStrings and the QString(const char *) constructor will be invoked. Similarily, you can pass a QString to a function that takes a const char * using the qPrintable() macro which returns the given QString as a const char *. This is equivalent to calling <QString>.toAscii().constData().
MfG, Alci.
Aktuelle Projekte:
FModPlayer: Audio-Player auf Basis von FModEx
Epp.org: C++-IDE mit MinGW-Compiler
Entwickelt wird unter anderem mit Qt 4.1.4
Aktuelle Projekte:
FModPlayer: Audio-Player auf Basis von FModEx
Epp.org: C++-IDE mit MinGW-Compiler
Entwickelt wird unter anderem mit Qt 4.1.4