Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7103

Fixed width QLabel with word wrapping clipped

    XMLWordPrintable

Details

    • 94759a0ed565b21c8dbfb4b12bfe6064f156b410

    Description

      A text QLabel with word wrapping enabled is clipped when set to fixed size in a single dimension, and constrained for space in the other dimension.

      Example (resize the window to see the clipping effect):

      #include <QtGui>
      
      int main(int argc, char **argv)
      {
      	QApplication app(argc, argv);
      
      	QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling.");
      	label->setWordWrap(true);
      	label->setFixedWidth(200);
      	label->setStyleSheet("background-color: cyan");
      	
      	QVBoxLayout *layout = new QVBoxLayout;
      	layout->addWidget(label);
      	layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
      
      	QWidget *widget = new QWidget();
      	widget->setLayout(layout);
      	widget->show();
      
      	return app.exec();
      }
      

      Attachments

        1. qlabel bug.jpg
          63 kB
          Jonathan Young
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            young.jpc Jonathan Young
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes