def testSignalEmission(self): qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem") view = QDeclarativeView() view.setSource(QUrl.fromLocalFile(adjust_filename('bug_951.qml', __file__))) self.app.exec_() self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED)
def reg(cls, component): qmlRegisterType(cls, _QML_PLUGIN, 1, 0, component)
#include <QDebug> from PySide.QtCore import QCoreApplication from PySide.QtDeclarative import QDeclarativeEngine, QDeclarativeComponent, qmlRegisterType from PySide.QtCore import qWarning, QUrl #include "person.h" from person import Person # int main(int argc, char ** argv) if __name__ == '__main__': # QCoreApplication app(argc, argv); app = QCoreApplication(sys.argv) # qmlRegisterType<Person>("People", 1,0, "Person"); qmlRegisterType(Person, 'People', 1, 0, 'Person'); # QDeclarativeEngine engine; engine = QDeclarativeEngine() # QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); component = QDeclarativeComponent(engine, QUrl("example.qml")) # Person *person = qobject_cast<Person *>(component.create()); person = component.create() # if (person) { if person: # qWarning() << "The person's name is" << person->name(); # qWarning() << "They wear a" << person->shoeSize() << "sized shoe"; qWarning("The person's name is {p.name}".format(p=person))
def registerComponents(): qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart'); qmlRegisterType(PieSlice, 'Charts', 1, 0, 'PieSlice');
from PySide.QtDeclarative import QDeclarativeEngine, QDeclarativeComponent, qmlRegisterType from PySide.QtCore import qWarning, QUrl #include "person.h" from person import Person #include "birthdayparty.h" from birthdayparty import BirthdayParty # int main(int argc, char ** argv) if __name__ == '__main__': # QCoreApplication app(argc, argv); app = QCoreApplication(sys.argv) # qmlRegisterType<Person>("People", 1,0, "Person"); qmlRegisterType(Person, 'People', 1, 0, 'Person'); # qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty"); qmlRegisterType(BirthdayParty, 'People', 1, 0, 'BirthdayParty'); # QDeclarativeEngine engine; engine = QDeclarativeEngine() # QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); component = QDeclarativeComponent(engine, QUrl("example.qml")) # BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); party = component.create() # if (party && party->host()) { if party and party.host: # qWarning() << party->host()->name() << "is having a birthday!";
from PySide.QtCore import QCoreApplication from PySide.QtDeclarative import QDeclarativeEngine, QDeclarativeComponent, qmlRegisterType from PySide.QtCore import qWarning, QUrl #include "person.h" from person import Person #include "birthdayparty.h" from birthdayparty import BirthdayParty # int main(int argc, char ** argv) if __name__ == '__main__': # QCoreApplication app(argc, argv); app = QCoreApplication(sys.argv) # qmlRegisterType<Person>("People", 1,0, "Person"); qmlRegisterType(Person, 'People', 1, 0, 'Person') # qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty"); qmlRegisterType(BirthdayParty, 'People', 1, 0, 'BirthdayParty') # QDeclarativeEngine engine; engine = QDeclarativeEngine() # QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); component = QDeclarativeComponent(engine, QUrl("example.qml")) # BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); party = component.create() # if (party && party->host()) { if party and party.host: # qWarning() << party->host()->name() << "is having a birthday!";
def reg(cls, component): qmlRegisterType(cls, 'eroge.tool', 0, 1, component)
def open_filter(self): self.text.set_active(True) self.text.show() @Slot() def text_display(self): # _register() # from qmlregister import register_qml_type # register_qml_type() # need to test qmlRegisterType once more self.view.engine().addImportPath('ui/lib') self.view.engine().addImportPath('ui/imports') self.view.setSource('ui/main.qml') self.view.setAttribute(Qt.WA_TranslucentBackground) self.view.setStyleSheet("background-color:transparent") self.view.setWindowFlags(Qt.SplashScreen | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.view.showFullScreen() if __name__ == '__main__': app = QApplication([]) qmlRegisterType(TextManagerQMLPlugin, 'eroge.tool', 1, 0, 'ReciveText') win = MainWindow() win.show() os._exit(app.exec_())