Details
-
Bug
-
Resolution: Done
-
P4: Low
-
4.7.0
-
None
-
d36a1dfb51af3f981262bc8e8fcd22b91aa890a6
Description
In the following small test program I attempt to draw some text string using font with capitalization set to AllUppercase. However, this text string appears in MixedCase in QPrintPreviewWidget and on the paper, whereas PDF contains correct results.
MyPrinter.h:
#ifndef MyPrinter_h #define MyPrinter_h #include <QtCore/QObject> #include <QtGui/QPrinter> class MyPrinter : public QObject { Q_OBJECT public: MyPrinter() { } virtual ~MyPrinter() { } public slots: void onPaintRequested( QPrinter* ); }; #endif
MyPrinter.cpp:
void MyPrinter:: onPaintRequested( QPrinter* printer ) { QPainter p; p.begin( printer ); QFont fnt( "Arial", 24 ); fnt.setCapitalization( QFont::AllUppercase ); p.setFont( fnt ); p.drawText( 0, 0, "Sample Text" ); p.end(); }
int main(int argc, char* argv[]) { QApplication app( argc, argv ); QPrinter printer; printer.setOutputFileName( "print_test.pdf" ); QPrintPreviewWidget ppw( &printer ); MyPrinter mp; mp.connect( &ppw, SIGNAL( paintRequested( QPrinter* ) ), &mp, SLOT( onPaintRequested( QPrinter* ) ) ); QFrame frm; QVBoxLayout vb( &frm ); vb.addWidget( &ppw ); QLabel lbl( "Test String" ); QFont fnt = lbl.font(); fnt.setCapitalization( QFont::AllUppercase ); lbl.setFont( fnt ); vb.addWidget( &lbl ); frm.show(); ppw.print(); return app.exec(); }