PDA

View Full Version : enum QPrinter::PaperSize value



uygar
19th January 2010, 02:04
Hi all;
I haven't need this before but this time I should learn.

The thin is, I add the sizes like this:

comboBoxST->addItem(QString::fromUtf8("A0 841 x 1189 mm"), QPrinter::A0);//5
comboBoxST->addItem(QString::fromUtf8("A1 594 x 841 mm"), QPrinter::A1);//6
And then I save the current data of combobox to database like this:

bbb.bindValue(12, comboBoxST->itemData(comboBoxST->currentIndex()));

And it seams like intager. Actually same intager values at QT Assistant (QPrinter::PaperSize)

My question is, how could I return values like QPrinter::A4.
What made the codes easy for me like:

printer->setPaperSize(QPrinter::Letter);//normally I use like this but I have integer
printer->setPaperSize(proporty_From_Value(int_a))

numbat
19th January 2010, 07:54
Use a cast:


printer->setPaperSize(static_cast<QPrinter::PageSize>(int_a));

uygar
20th January 2010, 01:12
Thank you. It really works.
I have learned some thing.