blob: 4650ad8d8f1d8acf4b8798df92c1441fe574359a (
plain)
123456789101112131415161718192021222324252627282930313233 | // Copyright (C) 2016 The Qt Company Ltd.// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause#include <QFont>#include <QFontMetrics>namespace src_gui_text_qfontmetrics {voidwrapper0() {//! [0] QFont font("times",24); QFontMetrics fm(font);int pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");int pixelsHigh = fm.height();//! [0]Q_UNUSED(pixelsWide);Q_UNUSED(pixelsHigh);}// wrapper0voidwrapper1() {//! [1] QFont font("times",24); QFontMetricsF fm(font); qreal pixelsWide = fm.horizontalAdvance("What's the advance width of this text?"); qreal pixelsHigh = fm.height();//! [1]Q_UNUSED(pixelsWide);Q_UNUSED(pixelsHigh);}// wrapper1}//src_gui_text_qfontmetrics
|