Results 1 to 3 of 3

Thread: enum QPrinter::PaperSize value

  1. #1
    Join Date
    Sep 2007
    Location
    Ankara TURKEY
    Posts
    32
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post enum QPrinter::PaperSize value

    Hi all;
    I haven't need this before but this time I should learn.

    The thin is, I add the sizes like this:
    Qt Code:
    1. comboBoxST->addItem(QString::fromUtf8("A0 841 x 1189 mm"), QPrinter::A0);//5
    2. comboBoxST->addItem(QString::fromUtf8("A1 594 x 841 mm"), QPrinter::A1);//6
    To copy to clipboard, switch view to plain text mode 
    And then I save the current data of combobox to database like this:
    Qt Code:
    1. bbb.bindValue(12, comboBoxST->itemData(comboBoxST->currentIndex()));
    To copy to clipboard, switch view to plain text mode 
    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:
    Qt Code:
    1. printer->setPaperSize(QPrinter::Letter);//normally I use like this but I have integer
    2. printer->setPaperSize(proporty_From_Value(int_a))
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jul 2009
    Posts
    139
    Thanks
    13
    Thanked 59 Times in 52 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: enum QPrinter::PaperSize value

    Use a cast:
    Qt Code:
    1. printer->setPaperSize(static_cast<QPrinter::PageSize>(int_a));
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to numbat for this useful post:

    uygar (19th January 2010)

  4. #3
    Join Date
    Sep 2007
    Location
    Ankara TURKEY
    Posts
    32
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: enum QPrinter::PaperSize value

    Thank you. It really works.
    I have learned some thing.

Similar Threads

  1. Different paperSize of QPrinter on Windows and Mac
    By cevou in forum Qt Programming
    Replies: 7
    Last Post: 15th June 2009, 08:55
  2. static enum in a class
    By mickey in forum General Programming
    Replies: 3
    Last Post: 19th August 2008, 19:02
  3. enum property
    By illuzioner in forum Qt Tools
    Replies: 10
    Last Post: 22nd August 2006, 21:47
  4. QPrinter::PrinterMode and QPrinter::setResolution??
    By SkripT in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2006, 11:59
  5. enum scope
    By illuzioner in forum General Programming
    Replies: 1
    Last Post: 15th February 2006, 05:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.