seanwu1105 / vscode-qt-for-python

Qt for Python (PySide and PyQt) extension for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=seanwu.vscode-qt-for-python
MIT License
191 stars 17 forks source link

`.qmllint.ini` not working #326

Open bambier opened 3 months ago

bambier commented 3 months ago

Describe the Bug It seems it doesn't respect .qmllint.ini file

To Reproduce Steps to reproduce the behavior:

  1. Install it
  2. create .qmllint.ini
  3. not working! 😑

Expected Behavior Not showing warnings and errors

Screenshots

image

Environment

Extension Configurations Nothing Additional context

This is my project structure (Controller directory was made after running pyside6-project run)

.
├── app
│   ├── accounting.pyproject
│   ├── assets
│   │   ├── fonts
│   │   │   ├── fontawesome
│   │   │   │   ├── FontAwesome-Brands.otf
│   │   │   │   ├── FontAwesome-Regular.otf
│   │   │   │   └── FontAwesome-Solid.otf
│   │   │   ├── material
│   │   │   │   ├── MaterialSymbolsOutlined.ttf
│   │   │   │   ├── MaterialSymbolsRounded.ttf
│   │   │   │   └── MaterialSymbolsSharp.ttf
│   │   │   └── vazirmatn
│   │   │       ├── Vazirmatn-UI-FD-NL-Black.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-Bold.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-ExtraBold.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-ExtraLight.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-Light.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-Medium.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-Regular.ttf
│   │   │       ├── Vazirmatn-UI-FD-NL-SemiBold.ttf
│   │   │       └── Vazirmatn-UI-FD-NL-Thin.ttf
│   │   └── imgs
│   │       ├── icon.ico
│   │       └── icon.png
│   ├── controlers
│   │   ├── __init__.py
│   │   └── LabeledIconButton.py
│   ├── Controllers
│   │   └── LabeledIconButton
│   │       ├── LabeledIconButtonmetatypes.json
│   │       ├── LabeledIconButton_qmltyperegistrations.cpp
│   │       ├── LabeledIconButton.qmltypes
│   │       └── qmldir
│   ├── main.py
│   ├── qml
│   │   ├── components
│   │   │   ├── Card.qml
│   │   │   └── LabeledIconButton.qml
│   │   ├── main.qml
│   │   └── sections
│   │       └── Header.qml
│   ├── qtquickcontrols2.conf
│   ├── resource.qrc
│   ├── resource_rc.py
│   └── utils
│       ├── __init__.py
│       ├── settings.py
│       └── shortcuts.py
├── LICENCE
├── README.md
└── requirements.txt

15 directories, 38 files

This is my .qmllint.ini file:

[General]
DisableDefaultImports=false
OverwriteImportTypes=
ResourcePath=app/resource.qrc
AdditionalQmlImportPaths=app/Controllers/
AdditionalQmlImportPaths=app/Controllers/LabeledIconButton

[Warnings]
BadSignalHandler=warning
TypeError=warning
UnknownProperty=warning
ImportFailure=warning
ReadOnlyProperty=warning
BadSignalHandlerParameters=warning
UnusedImports=warning
DuplicatedName=warning
PrefixedImportType=warning
AccessSingletonViaObject=warning
Deprecated=warning
ControlsSanity=warning
UnresolvedType=warning
LintPluginWarnings=warning
MultilineStrings=warning
RestrictedType=warning
PropertyAliasCycles=warning
VarUsedBeforeDeclaration=warning
AttachedPropertyReuse=warning
RequiredProperty=warning
WithStatement=warning
InheritanceCycle=warning
UnqualifiedAccess=warning
UncreatableType=warning
MissingProperty=warning
InvalidLintDirective=warning
CompilerWarnings=warning
UseProperFunction=warning
NonListProperty=warninig
IncompatibleType=warning
TopLevelComponent=warning
MissingType=warning
DuplicatePropertyBinding=warning

My LabeledIconButton.py is defined as:

# app/controlers/LabeledIconButton.py
from PySide6.QtCore import QObject, Slot
from PySide6.QtQml import QmlElement

QML_IMPORT_NAME = "Controllers.LabeledIconButton"
QML_IMPORT_MAJOR_VERSION = 1

@QmlElement
class LabeledIconButton(QObject):

    @Slot(int, result=bool)
    def changeScreen(self, idx: int) -> bool:
        print("python: ", idx)

        return True

and registerd using

# app/controlers/__init__.py
from controlers.LabeledIconButton import LabeledIconButton
from PySide6.QtQml import QQmlApplicationEngine

__all__ = [
    'LabeledIconButton',
    'register_controllers'
]

def register_controllers(engine: QQmlApplicationEngine) -> None:
    controller = LabeledIconButton()
    context = engine.rootContext()
    context.setContextProperty("controller", controller)

There is no problem when I run or compile codes but I don't know how to get rid of this warning it's really annoying

jtc42 commented 3 months ago

This seems to be an upstream issue, see https://bugreports.qt.io/browse/QTBUG-127602