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

Qt stylesheet should support text alignment for QHeaderView and QTableWidgetItem

XMLWordPrintable

      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.

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

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

              Created:
              Updated:

                There are no open Gerrit changes