#include#include int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel label("This is a long text that will wrap when the label width is exceeded."); label.setWordWrap(true); label.show(); return app.exec(); }
#includeThis example sets the label text to a long string and disables word wrapping using the setWordWrap method. When the label is displayed, the text is truncated and displayed as is when it exceeds the width of the label. Package/Library: Qt#include int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel label("This is a long text that will be truncated when the label width is exceeded."); label.setWordWrap(false); label.show(); return app.exec(); }