[Qt-jambi-interest] Strange behavior of QFileDialog

Gunnar Sletta gunnar at trolltech.com
Thu Aug 6 08:31:08 CEST 2009


José Arcángel Salazar Delgado wrote:
> Hello,
> 
> 
> in the previous version of jambi (4.5.0_1) a was using this code to give a
> default filename:
> 
> 
> String file = QFileDialog.getSaveFileName(null, "guardar archivo",
> Gerente.last().getNombreCompleto() + "-"
> + calendar.get(Calendar.DAY_OF_MONTH) + "-"
> + calendar.get(Calendar.MONTH) + "-"
> + calendar.get(Calendar.YEAR) + ".zip",
> new QFileDialog.Filter("Archivos Zip (*.zip)"));
> 
> 
> but now, this code does not work in jambi 4.5.2_1.
> Instead of giving a default filename, the line edit appears empty.
> 
> 
> Currently, im using this workaround:
> 
> 
> File file1 = new File(Gerente.last().getNombreCompleto() + "-" +
> calendar.get(Calendar.DAY_OF_MONTH) + "-"+ calendar.get(Calendar.MONTH) 
> + "-"+
> calendar.get(Calendar.YEAR) + ".zip");
> String file = QFileDialog.getSaveFileName(this, "Guardar archivo",
> file1.getAbsolutePath(),
> new QFileDialog.Filter("Archivos Zip (*.zip)"));
> 
> 
> i dont know if this is intentional or a bug.

Hi José,

I'm unable to reproduce this problem on windows using 4.5.2 with the 
following code. Anything missing?

import com.trolltech.qt.*;
import com.trolltech.qt.core.*;
import com.trolltech.qt.gui.*;

import java.util.*;

public class filedialog
{
     public static void main(String args[]) {
         QApplication.initialize(args);

         Calendar calendar = Calendar.getInstance();

         String name = "getNombreCompleto()"
                       + "-"
                       + calendar.get(Calendar.DAY_OF_MONTH) + "-"
                       + calendar.get(Calendar.MONTH) + "-"
                       + calendar.get(Calendar.YEAR) + ".zip";

         String file = QFileDialog.getSaveFileName(null,
                                                   "guardar archivo",
                                                   name,
                                                   new 
QFileDialog.Filter("Archivos Zip (*.zip)"));

         System.out.println(file);


//         QApplication.exec();
     }
}

best regards,
Gunnar



More information about the Qt-jambi-interest mailing list