ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

22 May 2020
2020-05-22×
22 May 2020
Hi, I'm struggling opening a text file with QT.
I have QFile(':/css/mycss') but I can"t read it or open it
J
any example to point to ? aaa = QFile(":/css/textsection.css") aaa.open(QIODevice.ReadOnly) aaa.readAll()returns `QIODevice::read (QFile, ":/css/textsection.css"): device not open b''`
you can always grep inside the examples directory, I can see many places where we use QFile. Maybe you are just missing yourfile.open(ReadOnly) or a WriteOnly option?
:/ is related to qrc or QUrl instances
C
do you have your css under a .qrc file?
the examples/xmlpatterns/schema example opens a file from a qrc file
and it only uses what you provided
schemaFile = QtCore.QFile(':/schema_%d.xsd' % index) schemaFile.open(QtCore.QIODevice.ReadOnly) schemaData = schemaFile.readAll()
C
<file alias="schema_0.xsd">files/contact.xsd</file> and that's the entry on the .qrc file
J
oh my bad, my alias in the qrc file was wrong..... 😵😵 sorry., really sorry. Loooking at it there is no "textmode", only binary, is it ?
there is a flag for TextMode
open(QtCore.QFile.ReadOnly | QtCore.QFile.Text)
J
indeed the flag is necessary but readAll doesn"t work (always return QbyteArray) but aaa.readData(aaa.bytesAvailable()) works.
if you believe it's a bug, you can always file a bug report with a minimal example, so we can try it out
Jim btw, a friend will look at the qmlRegister story, and see if he can improve some stuff... like adding the qmlRegisterSingletonType
C
hopefully he manages..
Calendar: May 2020
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