PDA

View Full Version : setting printer using Qt



rishiraj
2nd January 2009, 06:13
Hi guys,
First of all, my best wishes to you all for 2009.

I have been asked to work on a picture gallery created using Qt 3.3
In the first dialog ,thumbnails of the pictures in the gallery are shown and when you click on any of the thumbnails,an enlarged version of the selected picture is shown in a second dialog .A few options one of which is 'Print' are there in the second dialog box along with a Text Label over which the selected picture is set(The Text label name is 'pic_display')

Now,i wrote the following for the print() slot.
{
QPrinter * printer;
printer=new QPrinter;
if(printer->setup(this))
{
}
}

The code is working fine and when I click 'Print',the Print dialog is showing.
But,I am facing the following problems:
1) No printers are showing in the dialog.....does it mean that my system is not connected to any printers.(Lots of computers in the office.I think we have a central printer which we can connect to via LAN,am not sure though)

2)When I click on the print button(note it's in the second dialog box which shows the enlarged image),I want the path of the image to be shown in the Browse box.Currently,I have to browse to the location of the file which I want to print(which is the enlarged image)...is it possible to set it automatically each time I click 'print'.

I hope,I have been able to explain the problems clearly enough.
Your suggestions and advice are welcome.
Thanks in advance.

wysota
2nd January 2009, 09:20
Are the printers installed in the system? Qt uses lpr in 3.3 so any lpr or cups installed printer should be visible.

rishiraj
2nd January 2009, 10:12
Hi,thanks for the advice.I will try and see if any printers are installed in the system(new to linux,so not much idea of what to do or check)

wysota
2nd January 2009, 11:00
The easiest way is to open some application that supports printing using cups or lpr and see if it is able to print :)