Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Missing Borders on Widgets after PySide2 -> PySide6 Migration
Forum Updated to NodeBB v4.3 + New Features

Missing Borders on Widgets after PySide2 -> PySide6 Migration

Scheduled Pinned Locked Moved Unsolved Qt for Python
7 Posts 2 Posters 931 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.
  • S Offline
    S Offline
    somethingvague
    wrote on last edited by somethingvague
    #1

    Working on migrating a PySide2 application to PySide6, and noticed some weird widget appearance behavior after replacing the PySide2 imports with PySide6 at the top of the application file. In particular, some widgets in my grid layout are missing their left and, sometimes top, borders. See images below (PySide2 is first, PySide6 is second).

    PySide2

    PySide6

    It also appears that the header cells on one table picked up white separators that didn't exist before, but the other one didn't. Anyone else notice weird glitches like this? Thanks.

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

      Hi and welcome to devnet,

      On which OS are you seeing this ?
      Which version of PySide6 exactly ?
      Are you installing it through pip or conda ?

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

        Hello,

        I'm using

        Windows 10 Pro, Version 10.0.18363 Build 18363
        PySide 6.2.1 (6.2.2.1 still has the issue, and QTableWidgets are ugly in versions >= 6.2.2)
        Installing through pip

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

          Can you provide a minimal script that shows this behaviour ?

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

          S 1 Reply Last reply
          0
          • SGaistS SGaist

            Can you provide a minimal script that shows this behaviour ?

            S Offline
            S Offline
            somethingvague
            wrote on last edited by
            #5

            @SGaist

            This is about as minimal as I can get it. I removed pretty much everything from the app, except for the main view that I screenshotted. I even removed my subclassed QWidgetTables in favor of stock ones.

            # PySide2
            from PySide6.QtCore import *
            from PySide6.QtGui import *
            from PySide6.QtWidgets import *
            
            # Utility
            import sys
            
            class App(QMainWindow):
            
                def __init__(self, width, height):
                    super().__init__()
            
                                                                                            ### IMPORTANT ATTRIBUTES ###
            
                    self.content = QWidget()
                    self.setFixedSize(width, height)
                    self.setCentralWidget(self.content)
            
                                                                                            ### ELEMENTS & LAYOUT ###
            
                    # Elements
                    self.rx_table = QTableWidget()
                    self.rx_table.setRowCount(6)
                    self.rx_table.setColumnCount(7)
            
                    self.coeff_table = QTableWidget()
                    self.coeff_table.setRowCount(12)
                    self.coeff_table.setColumnCount(2)
            
                    self.sag_table = QTableWidget()
                    self.sag_table.setRowCount(4)
                    self.sag_table.setColumnCount(3)
            
            
                    open_button = QPushButton('Open')
                    print_button = QPushButton('Print')
                    layout_button = QPushButton('Layout')
                    sketch_button = QPushButton('Lens')
            
                    # Layout
                    layout = QGridLayout()
                    layout.addWidget(QLabel(), 0, 0, 6, 1)
                    layout.addWidget(self.rx_table, 6, 0, 6, 1)
                    layout.addWidget(self.coeff_table, 0, 1, 9, 4)
                    layout.addWidget(self.sag_table, 9, 1, 2, 4)
                    layout.addWidget(open_button, 11, 1)
                    layout.addWidget(print_button, 11, 2)
                    layout.addWidget(layout_button, 11, 3)
                    layout.addWidget(sketch_button, 11, 4)
                    self.content.setLayout(layout)
            
                    self.show()
            
            if __name__ == '__main__':
            
                app = QApplication(sys.argv)
            
                # Attempt to size the window according to screen resolution
                screen = app.primaryScreen()
                rect = screen.size()
                width = rect.width()
                height = rect.height()
            
                width = int(0.70*width)
                height = int(width/1.78)
            
                window = App(width, height)
            
                sys.exit(app.exec())
            
            

            alt text

            The bottom right table has all of its borders. The one above it is missing its top border. And the one on the left is missing its left border and its top. Here's the same app with the PySide6 references replaced with PySide2

            alt text

            The only other difference in the code is that I have to add the following lines to the PySide2 version for my high dpi screen. PySide6 handles this automatically. And even if I do leave them in the PySide6 code, the result is the same.

            QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
            QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              somethingvague
              wrote on last edited by
              #6

              Anyone? Can someone else run the minimal working example code I posted and tell me if they see the missing borders too? I'd like to know if this is a bug in PySide6 or if I'm doing something incorrectly. Thanks.

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

                That might be something Windows specific. I just tested with PySide 6.2.21 and 6.2.3 on macOS and three QTableViews are showing correctly.

                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