Qt For All

A beginner's Experiments With Qt

QFontMetrics to Paint a String

QFont font("times", 24);
QFontMetrics fm(font);
int pixelsWide = fm.width("What's the width of this text?");
int pixelsHigh = fm.height();
The Above example is taken from http://qt-project.org/doc/qt-5.0/qtgui/qfontmetrics.html#details
This will help to paint the QString properly.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Home
Subscribe to: Posts (Atom)
  • A Holiday Calendar in Qt
  • Campus Showcase
  • Some C++ Tickles..
  • Store a file in SQLite
  • Splash screen with an induced delay
  • Customised QCalendarWidget
  • A Clickable QLabel!
  • Exporting a document to PDF
  • Exporting a document to ODF
  • Why to use QImageReader!
  • Database path issue ( Symbian )
  • COW - Copy On Write
  • Manually set Geometry of the Outer most layout
  • 4 Quick tips to adjust Font Size.
  • 5 Basic steps of Qt - Translation
  • Set Up Creator For Thrift
  • Building QtWebkit
  • QFontMetrics to Paint a String
  • Qt DBus : A Simple Example
  • Shell Script : To generate Qt DBus xml, Proxy and Adaptors.
  • Set up Qt SDE For Android on Ubuntu

About Me

Rahul Das
View my complete profile
Simple theme. Powered by Blogger.