Description
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>
Activity
ariefdjauhari commentedon Dec 31, 2024
Hi bro.. just had the problems, and it solved by writing full path in style.json, just write the full path to the icon folder
KhamisiKibet commentedon Dec 31, 2024
ariefdjauhari commentedon Jan 1, 2025
Kaemer1645 commentedon Feb 3, 2025
I found that setting the following paths resolved the problem:
Additionally, I compiled all .ui files using:
Custom_Widgets --convert-ui ui --qt-library PySide6
I am also utilizing the automatically generated file by the library:
..\Qss\icons\_icons.qrc