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 change the color of the row in following cases

How to change the color of the row in following cases

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 604 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    I have a QTableWidget https://ibb.co/gSSDon with two columns

    MY requirement is whenever we fill both the columns of a single we should change the background color of the row to yellow

    Can some one help me in writing the code for the same

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You can change the background color of a QTableWidgetItem with QTableWidgetItem::setBackground(): http://doc.qt.io/qt-5/qtablewidgetitem.html#setBackground

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        I was looking for which signal is emitted when to swap from one row to other

        using mouse clicks , tab press , or call of ::insertRow method

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Just take a look at the signals of QTableWidget: http://doc.qt.io/qt-5/qtablewidget.html#signals I'm sure you'll find a signal which fits your needs ...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          4

          • Login

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