ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

4 October 2022
2022-10-04×
4 October 2022
A
anya ♥Still not working https://0x0.st/oJpw.png
Are you testing on a Linux system, what's your desktop environment? I think maybe that your Desktop Environment compositor not compatible with translucent main widget. You may need to test the same code on another DE, or probably better on Windows OS.
I expected KDE to support it so I never really checked but I guess not, I'm mostly only making this for myself, as a fun little project
A
I saw the color picker tool on Windows PowerToys and thought that was pretty neat, I looked at Linux alternatives and they were pretty old and looked kinda meh plus most of them aren't maintained anymore
Can confirm the pastebin works with a compositor running. (xcompmgr on X11 here)
I
When I kill the compositor, black background appears instead (as expected).
A
Thanks everyone, seems like the compositor got disabled due to some reason. Maybe something to do with Nvidia drivers in the past. Works perfectly fine now that I re-enabled it
I'm trying to use @QmlSingleton to manage my global variables in python. According to the documentation I only need to use @QmlElement followed by @QmlSingleton so that QQmlEngine will try to create a singleton instance using the type’s default constructor. This is the code so far: QML_IMPORT_NAME = "g1.backend.main" QML_IMPORT_MAJOR_VERSION = 1 @QmlElement @QmlSingleton class MySingleton(QObject): def __init__(self): self.folderPath = scriptDir + os.path.sep + '\\temp\\' @Slot(result=str) def getArea(self): return self.folderPath
Then I'm importing import g1.backend.main 1.0 from the qml file but I'm not able to call the MySigleton class. Do I need to register singleton or import differently? This is the error: <Unknown File>: qmlRegisterSingletonType(): "MySingleton" is not available because the callback function returns a null pointer.
F
I appreciate any help
C
can you drop the constructor of the class and place the content of the variable on the return statement?
C
(I'm going AFK now, but can read your comments tomorrow morning, maybe other folks will be able to help you! bye)
QML_IMPORT_NAME = "g1.backend.main" QML_IMPORT_MAJOR_VERSION = 1 @QmlElement @QmlSingleton class MySingleton(QObject): @Slot(result=str) def getFolder(self): return "c:\\" and in QML I'm trying this: Text { id: lblFolderLocation text: MySingleton.getFolder() } And the error is this now: file:///C:/Users/Francisco/Documents/G1_QML/qml/pages/newAnalysis.qml:88:17: Unable to assign [undefined] to QString
But my intention was to create a class in python to manage the application's global variables. So I started the singleton class with the ini constructor. Perhaps the best solution is to work with Pragma Singleton and manage everything through QML
F
Another option would be to create getters and access the class variable: @QmlElement class Getter(QObject): @Slot(result=str) def getFolder(self): return Main.folderPath Sorry for these questions. I come from data science and GUI, QML and OOP is quite new to me
Calendar: October 2022
Archive by month
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog