QLabel* label = new QLabel("Lorem ipsum dolor sit amet"); QFont font = label->font(); font.setStrikeOut(true); label->setFont(font);
QFontDatabase database; foreach(const QString& family, database.families()) { QFont font(family, 12); font.setStrikeOut(true); QApplication::setFont(font); }In this example, strikeout is set for all available fonts in the current system. QFontDatabase is used to retrieve font families and then a loop is created to iterate through all families. A QFont object is created with a specific size, strikeout is set to true and then it is set to the entire application. This code can be used in the main function of Qt application. Package Library: Qt/QtCore.