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. Migration from Qt 5.15.7 to Qt 6.7.0 and a small problem with QTreeWidget
Forum Updated to NodeBB v4.3 + New Features

Migration from Qt 5.15.7 to Qt 6.7.0 and a small problem with QTreeWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 277 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.
  • A Offline
    A Offline
    AgentX
    wrote on last edited by
    #1

    Hi everybdy,

    I'm now developping with Qt since 2010, I think (something like that), my last project has been developped with Qt 5.15.7 and I now need to convert it to Qt 6.7.0 for some reasons.

    The problem I got is wit the QTreeWidget, and especially the items.

    A simple example :

        QTreeWidget* tree = new QTreeWidget(this);
            tree->setColumnCount(2);
            setCentralWidget(tree);
         
            QTreeWidgetItem *item = new QTreeWidgetItem;
            item->setText(0, "blablabla");
            item->setText(1, "blablabla");
            tree->addTopLevelItem(item);
            item->setForeground(0, QBrush(Qt::red));
            item->setBackground(1, QBrush(Qt::red));
    

    is giving me this :
    testFG.jpg

    As you can see, the background is set in red (setBackground ok), but not the text (setforeground nok).
    Of course, it was working flawlessly with Qt 5.15.7 (and it's a very basic thing, so...). Do I miss something? Did you find thins kind of problem and do you have any idea how to solve it? I've fixed all the other inconveniances I've found, due to the upgraded Qt, but this one...

    Thanks everyone!

    Qt 6.7.0 / Windows / MSVC2019

    Christian EhrlicherC 1 Reply Last reply
    0
    • A AgentX

      Hi everybdy,

      I'm now developping with Qt since 2010, I think (something like that), my last project has been developped with Qt 5.15.7 and I now need to convert it to Qt 6.7.0 for some reasons.

      The problem I got is wit the QTreeWidget, and especially the items.

      A simple example :

          QTreeWidget* tree = new QTreeWidget(this);
              tree->setColumnCount(2);
              setCentralWidget(tree);
           
              QTreeWidgetItem *item = new QTreeWidgetItem;
              item->setText(0, "blablabla");
              item->setText(1, "blablabla");
              tree->addTopLevelItem(item);
              item->setForeground(0, QBrush(Qt::red));
              item->setBackground(1, QBrush(Qt::red));
      

      is giving me this :
      testFG.jpg

      As you can see, the background is set in red (setBackground ok), but not the text (setforeground nok).
      Of course, it was working flawlessly with Qt 5.15.7 (and it's a very basic thing, so...). Do I miss something? Did you find thins kind of problem and do you have any idea how to solve it? I've fixed all the other inconveniances I've found, due to the upgraded Qt, but this one...

      Thanks everyone!

      Qt 6.7.0 / Windows / MSVC2019

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Please check with fusion or windowsvista style when you're using windows 11.

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

      A 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Please check with fusion or windowsvista style when you're using windows 11.

        A Offline
        A Offline
        AgentX
        wrote on last edited by
        #3

        @Christian-Ehrlicher said in Migration from Qt 5.15.7 to Qt 6.7.0 and a small problem with QTreeWidget:

        windowsvista

        Thanks! so stupid I didn't try that... Perfect with WindowsVista

        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