Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Enumeration of the rows(Vertical Header) is not aligned horizontally with data in the table
Forum Updated to NodeBB v4.3 + New Features

Enumeration of the rows(Vertical Header) is not aligned horizontally with data in the table

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 734 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ankita thakur
    wrote on last edited by
    #1

    Hi All,

    I am facing this issue with QTableWidget where the vertical header having enumeration for the rows in the table is not aligned horizontally with the data in the rows.

    0_1563515809048_07053fb3-115c-47eb-a611-8210872e7af2-image.png

    Is there any setting that can help me to get these in correct alignement

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How are you setting up that QTableView ?
      By the way, which version of Qt is it ?
      On what OS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Ankita thakur
        wrote on last edited by
        #3

        Hi

        QT version: 5.11 and its on Windows.
        What do you mean by setting up QTable View? What information is needed for this??
        Made a member of QTable view and added a QAbstractTableModel as its model.

        Setting up the row count and column count for the table using the model. Using header data to set the column headers and row numbers:
        QVariant DINModel::headerData(int section, Qt::Orientation orientation, int role) const {
        if (role != Qt::DisplayRole)
        return QVariant();

        if (orientation == Qt::Horizontal) {
        	switch (section)
        	{
        	case portType:
        		return "Port";
        		break;
        	case labelType:
        		return "Event Label";
        		break;
        	case dinType:
        		return "Digital Input";
        		break;
        	}
        }
        else {
        	return QString("%1").arg(section + 1);
        }
        return QVariant();
        

        }

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then please provide the complete code of your model so it can be tested.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved