Skip to content

Icons, what is going on? #120

@Kaemer1645

Description

@Kaemer1645

This is the structure of the example QMainWindow project uploaded by you on GitHub:

C:\dev\PyqtModernUi\example\QT-PyQt-PySide-Custom-Widgets\examples\PySide6\QMainWindow> rptree
.\
├── Qss\
│   ├── icons\
│   │   ├── arrow-down-left.svg
│   │   ├── github.svg
│   │   ├── maximize-2.svg
│   │   ├── minimize-2.svg
│   │   └── x.svg
│   └── scss\
│       ├── _styles.scss
│       ├── _variables.scss
│       ├── defaultStyle.scss
│       └── main.scss
├── generated-files\
│   ├── css\
│   │   └── main.css
│   └── json\
├── logs\
│   └── custom_widgets.log
├── icons.qrc
├── icons_rc.py
├── interface.ui
├── main.py
├── style.json
└── ui_interface.py

I moved and deleted the default QMainWindow/icons folder to QMainWindow/Qss/icons because your package always seems to look for icons there. However, when I copy and paste the icon path from Qt Designer like this: :/icons/Qss/icons/github.svg into style.json, it creates confusion.

The path :/icons/Qss/icons/minimize-2.svg does not work; instead, I get an error: "path doesn't exist" and "qt.svg: Cannot open file 'C:/dev/PyqtModernUi/example/QT-PyQt-PySide-Custom-Widgets/examples/PySide6/QMainWindow/Qss/icons/Qss/icons/maximize-2.svg', because: System cannot find the specified path."

On the other hand, this type of path works properly: :icons/Qss/icons/minimize-2.svg.

What am I doing wrong? Could someone please explain why this is happening?

Is there any posibilities to use my own icons without using and creating qss/icons folder?

Style.json look like this

{
    "QMainWindow": [
		{
			"tittle":"My New Tittle",
			"icon":":icons/Qss/icons/github.svg",
			"frameless": true,
			"transluscentBg": true,
			"sizeGrip": "size_grip",
			"shadow":[
				{
					"color": "#fff",
					"blurRadius": 20,
					"xOffset": 0,
					"yOffset": 0,
					"centralWidget": "centralwidget"
				}
			],
			"navigation":[
				{
					"minimize":"minimize_window_button",
					"close": "close_window_button",
					"restore":[
						{	
							"buttonName": "restore_window_button",
							"normalIcon": ":icons/Qss/icons/maximize-2.svg",
							"maximizedIcon": ":icons/Qss/icons/minimize-2.svg"
						}
					],
					"moveWindow": "header_widget",
					"tittleBar": "header_widget"
				}
			]
		}
	],
	
	
	"QSettings": [
        {
            "ThemeSettings": [
                {
                    "CustomTheme": [
                        {
                            "Background-color": "#00FF00",
                            "Text-color": "#000",
                            "Accent-color": "#40a6e2",
                            "Theme-name": "Default-Light",
                            "Icons-color": "#8393a3",
                            "Default-Theme": false,
							"Create-icons": false
                        },
                        {
                            "Background-color": "#283a4d",
                            "Text-color": "#fff",
                            "Accent-color": "#40a6e2",
                            "Theme-name": "Default-Dark",
                            "Icons-color": "#8393a3",
                            "Default-Theme": false,
							"Create-icons": false
                        }
                    ]
                }
            ],
            "AppSettings": {
                "OrginizationName": "QT Settings Session abab",
                "ApplicationName": "QT Settings Session Company abab",
                "OrginizationDormain": "QT Settings Session.org abab"
            }
        }
    ]
	
	
}

and icons.qrc

<RCC>
  <qresource prefix="icons">
    <file>Qss/icons/arrow-down-left.svg</file>
    <file>Qss/icons/github.svg</file>
    <file>Qss/icons/maximize-2.svg</file>
    <file>Qss/icons/minimize-2.svg</file>
    <file>Qss/icons/x.svg</file>
  </qresource>
</RCC>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions