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. How to set top-left cell text of QTableWidget ?
Forum Updated to NodeBB v4.3 + New Features

How to set top-left cell text of QTableWidget ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.7k Views
  • 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    It is called QTableCornerButton.

    https://github.com/sonichy

    jsulmJ BramhaB 2 Replies Last reply
    0
    • sonichyS sonichy

      It is called QTableCornerButton.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @sonichy http://doc.qt.io/qt-5/qtablewidget.html#setItem

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • sonichyS sonichy

        It is called QTableCornerButton.

        BramhaB Offline
        BramhaB Offline
        Bramha
        wrote on last edited by
        #3

        Hi, @sonichy you can add text on that by finding its child QAbstractButton and then add a widget to it as QLabel using the vertical layout as below.

        QAbstractButton* button = qFindChild< QAbstractButton* >(TableWidget);
        if (button)
        {
        QVBoxLayout* lay = new QVBoxLayout(button);
        lay->setContentsMargins(0, 0, 0, 0);
        QLabel* label = new QLabel("No");
        label->setStyleSheet("QLabel {font-face: ArialMT; font-size: 10px; color: #FFFFFF; font-weight: bold; }""QToolTip { color: #ffffff; background-color: #000000; border: 1px #000000; }");
        label->setAlignment(Qt::AlignCenter);
        label->setToolTip("Text");
        label->setContentsMargins(2, 2, 2, 2);
        lay->addWidget(label);
        }

        1 Reply Last reply
        2

        • Login

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