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. QTableWidget's Header background color doesn't work in Win7
Forum Updated to NodeBB v4.3 + New Features

QTableWidget's Header background color doesn't work in Win7

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.5k 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.
  • J Offline
    J Offline
    joergpauly
    wrote on last edited by
    #1

    Hello, everyone,

    I've generated a duty roster using QTableWidget, having the horizontal headers the colleague's names and the vertical headers as a calendar, showing weekdays and holidays.

    I use the background colors of the QTableWidgetItem that goes as headerItem with the following code snippet:
    @ for(int i = 0; i < pDate.daysInMonth(); i++)
    {
    pDate.setDate(pDate.year(),pDate.month(),i+1);
    QTableWidgetItem* litem = new QTableWidgetItem();
    QString dt = QDate::shortDayName(pDate.dayOfWeek());
    dt.append("\n");
    dt.append(QString::number(i+1));
    litem->setText(dt);

        if(pDate.dayOfWeek() == 6)
        {
            litem->setBackground(QBrush(lSat));
            lwdays--;
        }
    
        if(pDate.dayOfWeek() == 7)
        {
            litem->setBackground(QBrush(lSun));
            lwdays--;
        }
    
        if(m_Holidays->checkForHoliday(pDate))
        {
            litem->setForeground(QBrush(lHolFg));
            litem->setBackground(QBrush(lHol));
            if(pDate.dayOfWeek()<6)
            {
                lwdays--;
            }
        }
    
        ui->tbwRoster->setHorizontalHeaderItem(i,litem);
        ui->tbwRoster->setColumnWidth(i,25);
    }@
    

    It works fine on Linux, but the background color does not change on Windows...

    Is it a bug, or am I doing wrong?

    Regards
    Joerg

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

      Hi,

      This rings a bell but I'm not sure. You should check the "bug report system":http://bugreports.qt-project.org to see if it's something known.

      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
      • J Offline
        J Offline
        joergpauly
        wrote on last edited by
        #3

        Hi,

        checked it, couldn't find anything.

        But here's some additional info:

        You get the same result when using colors with QPalette::Button for QPushButton and QComboBox.

        But when you change the Windows color scheme from "Win7", i.e. Aero, to "Classic", everything works fine, the colors are displayed correctly.

        The disadvantage is your desktop looks like Win95... do we want this...? :-)

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

          Surely not :)

          But this rings a bell, IIRC there was a bug related to the Aero theme but I can't remember exactly the thing

          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
          • J Offline
            J Offline
            joergpauly
            wrote on last edited by
            #5

            So, I'd say the bug is still unsolved... :(

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

              If you didn't find anything (maybe it was mentioned on the interest mailing list), then please open a new bug report providing a minimal compilable example that shows the problem

              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