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

Qt stylesheet should support text alignment for QHeaderView and QTableWidgetItem

    XMLWordPrintable

Details

    Description

      The following stylesheet should place the QTableViews headers text in the middle and also the QTableWidgetItem.

      QHeaderView::section {
      text-align: left center;
      }
      QTableWidgetItem {
      text-align: left center;
      }
      

      QTableWidgetItem's setTextAlignment should be exposed to qss:

      QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB").arg(int((size + 1023) / 1024)));
      sizeItem->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      

      QTableWidgets (and QTableViews) headers alignment can be also set in c++ with setDefaultAlignment() and it should be exposed to qss.

      Please check the attached application for test.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            frederik Frederik Gladhorn
            qtcomsupport Qt Support
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes