Showing posts with label QT/QML. Show all posts
Showing posts with label QT/QML. Show all posts

How to create qrc file(qml) in Python Qt(PyQt)

1. create qml file 
 - main.qml 
 - test.qml


2. create resource.qrc file
resource.qml code

-----------------------------------

<RCC>

<qresource>

    <file>qml/main.qml</file>

    <file>qml/test.qml</file>

</qresource>

</RCC>
-----------------------------------


3. execute command in terminal (in workspace included qml files)
 $ pyside2-rcc -o resource.py resource.qrc


4. check resource.py file 
 : 
Completed when the resource.py file is created.

 

 

How to use qrc file!

1. in main.py 

ex ) qrc:///filename

QUrl("qrc:///qml/test.qml")

 

2. in main.qml file

ex ) qrc:/qml/test.qml

source: "qrc:/qml/test.qml"


#qrc #resource.qrc #resource.py #python #qt #pyqt #pyside2-rcc


Error PyQt5, pylint can't find QWidget and QApplication

Issue :
Error PyQt5, pylint can't find QWidget and QApplication

Solve:
Create ".pylintrc" with .py file in current directory

Create ".pylintrc"
And add content

extension-pkg-whitelist=PyQt5

This error seems to be said… reliability issue for PyQt...
Actually I don't know why this error occurs.
I tried to re-occur the error, but it didn't occur.

#pylint #PyQt #PyQt5 #can't find QWidget and Qapplication #pylintrc


How to link toolchain to qtcreator (download toolchain in linaro)

1. Download Toolchain 
https://www.linaro.org/downloads/

2. Click on Tools at the top of the Qtcreator -> build& run 

3. Set up the Cmake. (This is just a skip. I won't use it even if I set it up.)
Press "Add…" and set as below (based on default path when installing the toolchain)
Path : /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/cmake

Qt Creator 
File 
•.7 Apply 
Edit 
Design 
ProJects 
Build 
*bug 
Analyz 
Projects 
Examples 
Tutorials 
New to Qt? 
Learn how to develop: 
own applications and 
explore Qt Creator. 
Get Started Nou 
Qt Account 
Online Community 
Blogs 
user Guide 
1001s window Help 
Options 
Filter 
Environment 
Text Editor 
FakeVim 
Help 
QtQuick 
Build & Run 
Debugger 
Designer 
Analyzer 
Version Control 
Devices 
Code Pasting 
QA Testing 
Build & Run 
General Kits 
Name 
• Auto-detected 
Qt Versions 
Compilers 
Debuggers 
Qbs 
CMake 
System CMake at /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/cmake 
System CMake at /usr/bin/cmake (Default) 
Manual 
ü)cation 
/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/•• 
/usr/bin/cmake 
Add 
Clone 
Remove 
Make Default 
Name: System CMake at /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/cmake 
Path: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/cmake 
Autorun CMake 
Auto-create build directories 
Browse... 
X 
Cancel


4. Click Debuggers -> "Add…" and add as below
Path: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-gdb
Options 
Filter 
Environment 
Text Editor 
FakeVim 
Help 
QtQuick 
Build & Run 
Debugger 
Designer 
Analyzer 
Version Control 
Code Pasting 
QA Testing 
•.7 Apply 
Build & Run 
General Kits 
Name 
Qt Versions 
Compilers 
ü)cation 
/usr/bin/gdb 
Debuggers 
Qbs 
CMake 
Auto-detected 
System GDS at /usr/bin/gdb 
Manual 
New Debugger 
Add 
Clone 
Remove 
-linux/aarch64-gnu-linux-gdb 
Type 
GOB 
GOB 
Name: 
Path: 
Type: 
ABIs: 
Version: 
Wo rking directory. 
New Debugger 
-linux/aarch64-gnu-linux-gdb 
GOB 
unknown-linux-generic-elf-unknown 
7.11.1 
Browse... 
Browse... 
Cancel


5. Compiler -> "Add…" and add C++(g++) / C(gcc)
c++ compiler path : /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-g++
c compiler path: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-gcc

Options 
Filter 
Environment 
Text Editor 
FakeVim 
Help 
QtQuick 
Build & Run 
Debugger 
Designer 
Analyzer 
Version Control 
Devices 
Code Pasting 
QA Testing 
•.7 Apply 
Build & Run 
General Kits 
Name 
Qt Versions 
Compilers Debuggers 
Type 
Qbs 
CMake 
GCC (C++, x86 32bit in /usr/bin) 
GCC 5 (C++, x86 64bit in /usr/bin) 
GCC 5 (C++, x86 32bit in /usr/bin) 
GCC (C, x86 64bit in /usr/bin) 
GCC (C, x86 32bit in /usr/bin) 
GCC 5 (C, x86 64bit in /usr/bin) 
GCC 5 (C, x86 32bit in /usr/bin) 
GCC (C, x86 64bit in /usr/bin) 
GCC (C, x86 32bit in /usr/bin) 
GCC 5 (C, x86 64bit in /usr/bin) 
GCC 5 (C, x86 32bit in /usr/bin) 
Manual 
Name: 
Compiler path: 
GCC 
GCC 
GCC 
GCC 
GCC 
GCC 
GCC 
GCC 
GCC 
GCC 
GCC 
Clone 
Remove 
Platform codegen flags: 
Platform linker flags: 
arm-linux-generic-elf-64bit 
-linux/aarch64-gn u-linux-gccl 
generic 
l' 
Browse... 
64bit 
X 
Cancel


6. Select Qt versions -> "Add…" and select qmake in toolcain

Options 
Filter 
Environment 
Text Editor 
FakeVim 
Help 
QtQuick 
•.7 Apply 
Build & Run 
General Kits 
Name 
Qt Versions 
Compilers Debuggers 
qmake Location 
Qbs 
CMake 
Auto-detected 
Qt5.10.o GCC 64bit 
Manual 
/opt/Qt5.10.O/5.10.0/gcc_64/bin/qmake 
Add... 
Remove 
Clean up 
QA 
Build & Run 
Debugger 
Designer 
Analyzer 
Version Control 
Devices 
Code Pasting 
Testing 
At 5.5.1in PATH 
Qt 5.9.3 in PATH (qt5) /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/qt5/qmake 
Version name: Qt in PATH (qt5) 
qmake location: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/qt5/qmake 
Qt version 5.9.3 for Embedded Linux 
Browse... 
Details 
Cancel


7. Select "Kits" -> Set to the same value as below
Device type: Generic linux device
sysroot: /usr/local/oecore-x86_64/sysroots/aarch64-gnu-linux
compiler: 5.Compiler
debugger: 4.debugger
qt: 6.qmake
cmake : /usr/bin/cmake


8. Input Command in Command
$ sudo -s

modify bashrc (add command)
$ vi ~/.bashrc
.…
alias qtcreator='source /usr/local/oecore-x86_64/environment-setup-aarch64-gnu-linux;
/opt/Qt5.10.0/Tools/QtCreator/bin/qtcreator'
...

And save 
$source ~/.bashrc

9. When running Qt, you must always run qtcreator as command from the terminal to build... I don't know why.


#QT #QtCreator #Qmake #C++ #C #Linux #Embedded #Download Toolchain  #toolchain #Linaro

Apartment Buying Guide 2025: Shocking Red Flags You Should NEVER Ignore!

 🏙️ Apartment Buying Guide 2025: Shocking Red Flags You Should NEVER Ignore! 🚨 Are you thinking about buying an apartment in 2025? 🏢  It’...