def main(): # Create main app myApp = QGuiApplication(sys.argv) # myApp.setWindowIcon(QIcon('./images/icon.png')) # Create a View and set its properties appView = QQuickView() appView.setMinimumHeight(640) appView.setMinimumWidth(1024) appView.setTitle('Authorize Kerberos') engine = appView.engine() engine.quit.connect(myApp.quit) context = engine.rootContext() # add paths appDir = 'file:///' + QDir.currentPath() context.setContextProperty('appDir', appDir) # add controllers mainController = MainController() context.setContextProperty('PyConsole', mainController) context.setContextProperty('mainController', mainController) # Show the View appView.setSource(QUrl('./qml/main.qml')) appView.showMaximized() # Execute the Application and Exit myApp.exec_() sys.exit()
for i in range(self.m_segment_count): t = i / (self.m_segment_count - 1) invt = 1 - t pos = invt * invt * invt * self.m_p1 \ + 3 * invt * invt * t * self.m_p2 \ + 3 * invt * t * t * self.m_p3 \ + t * t * t * self.m_p4 vertices[i].set(pos.x() * w, pos.y() * h) self.node.markDirty(QSGNode.DirtyGeometry) return self.node if __name__ == '__main__': import sys app = QGuiApplication(sys.argv) qmlRegisterType(BezierCurve, "CustomGeometry", 1, 0, "BezierCurve") view = QQuickView() format = view.format() format.setSamples(16) view.setFormat(format) view.setSource(QUrl('main.qml')) view.show() view.showMaximized() sys.exit(app.exec_())