UN-GCPDS / qt-material

Material inspired stylesheet for PySide2, PySide6, PyQt5 and PyQt6
https://qt-material.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
2.27k stars 241 forks source link

Border issue with styling #23

Closed govindashrit closed 3 years ago

govindashrit commented 3 years ago

Hello ,

White mark ( Border ) appears when using theme='dark_blue.xml' ( Seen with other themes) , which is due below styling of QFrame

Environment : PySide2 5.15.2 and qt-material=2.8.4

Issue_Image

Issue seen since v 2.8.2 v2.8.0 – No issue v2.8.1 – No issue v2.8.2 – Issue v2.8.3 – Issue v2.8.4 – Issue

/material.css.template /

QFrame { background-color: {{secondaryDarkColor}}; border: 1px solid {{secondaryColor}}; / Border appears due to this Either can have background color which hides this issue or Border radius can be 0px / border-radius: 4px; }

Note: Its always possible to override styling in custom,css which I am currently doing which solves the issue. It would be great to have fix in package.

Awesome project nicely done to suit Material Design. Kudo's 👍

Thanks and Regards, Govind

YeisonCardona commented 3 years ago

Hi @govindashrit I'm not able to reproduce this issue, are you on windows? can you give me minimal code to understand how widgets are placed.

Thanks.

govindashrit commented 3 years ago

Hello Yeison,

Please find the attached Sample Application (SouceCode src.zip). Yes I am windows OS. src.zip

MainApp.py - QApplication - To start the application,

Thanks Govind

YeisonCardona commented 3 years ago

Hi @govindashrit There is no way that I can reproduce this effect in my operating system, if you want, write the style correction and I will check that's not affect anything else and then added it to the source code.

govindashrit commented 3 years ago

Hello @YeisonCardona

Yes the issue is seen on Windows and NOT on ios

Style Correction

QFrame { border-radius: 0px; }

Thanks Govind

YeisonCardona commented 3 years ago

Hi @govindashrit

Looking at your code closely, these changes would handle this issue:

class MainTabBar(QWidget):

    def __init__(self) -> None:
        super().__init__()
        # self.v_layout = QVBoxLayout(self)  # <- self here

        # Initialize tab screen
        self.tabs = QTabWidget(self)
        self.tab1 = Tab1()
        self.tab2 = Tab2()

        self.tabs.addTab(self.tab1, "Tab1")
        self.tabs.addTab(self.tab2, "Tab2")

        self.tab1.get_contents()
        self.tab2.get_contents()
        # self.v_layout.addWidget(self.tabs)
        # self.setLayout(self.v_layout)

Have you try Qt Designer is a really useful tool for handle GUIs development ;)

govindashrit commented 3 years ago

Hello Yeison,

I tried your code changes, I still see the issue. image

Code changes as you suggested class MainTabBar(QWidget):

def __init__(self) -> None:
    super().__init__()
    # self.v_layout = QVBoxLayout(self)

    # Initialize tab screen
    self.tabs = QTabWidget(self)
    self.tab1 = Tab1()
    self.tab2 = Tab2()

    self.tabs.addTab(self.tab1, create_icon('mdi.home'), "Tab1")
    self.tabs.addTab(self.tab2, create_icon('mdi.script-text-outline'), "Tab2")

    self.tab1.get_contents()
    self.tab2.get_contents()
    # self.v_layout.addWidget(self.tabs)
    # self.setLayout(self.v_layout)

Yes I have tried Qt designer, but for my usecase (dynamic creation of tabs) , I wish to do it programmatically.

For reproducing the issue, made this sample application.

Regards, Govind R

YeisonCardona commented 3 years ago

The sample code is hard to debug, with a lot of unnecessary lines, empty inherited classes, redundant calls, basically is not a minimal code. Somewhere there must be a widget created without the correct parent and avoiding the styles heritage, maybe.