Discussion:
[Maya-Python] Display QQmlApplicationEngine
Ruchit Bhatt
2018-07-30 16:57:15 UTC
Permalink
How to run & display QQmlApplicationEngine in Maya using PySide2?
Here is my code

class Ball(QObject):
def __init__(self):
QObject.__init__(self)

@Slot(int)
def add(arg1):
mc.polySphere(r=arg1)


engine = QQmlApplicationEngine()
ball = Ball()
engine.rootContext().setContextProperty("ball", ball)
engine.load(QUrl.fromLocalFile("E:/code/QML/sphere.qml"))
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d1a58266-9ab4-4ce9-ad4e-463a8e850d5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2018-07-30 19:29:10 UTC
Permalink
Is it giving you an error? You do have a bug in your Ball.add(). It should
be

@Slot(int)
def add(self, arg1):
mc.polySphere(r=arg1)
Post by Ruchit Bhatt
How to run & display QQmlApplicationEngine in Maya using PySide2?
Here is my code
QObject.__init__(self)
@Slot(int)
mc.polySphere(r=arg1)
engine = QQmlApplicationEngine()
ball = Ball()
engine.rootContext().setContextProperty("ball", ball)
engine.load(QUrl.fromLocalFile("E:/code/QML/sphere.qml"))
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/d1a58266-9ab4-4ce9-ad4e-463a8e850d5b%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/d1a58266-9ab4-4ce9-ad4e-463a8e850d5b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2c4VS5ZMYUb%2Bt6AFNmarpjBLWWhsOtir5GGVjMehj70Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Ruchit Bhatt
2018-07-30 20:22:38 UTC
Permalink
I did few test with QQMLAPPLICATIONENGINE outside Maya & everything works fine. Problem with Maya is, If I use
app = QApplication(sys.argv)

Maya give a error
# Error: RuntimeError: A QApplication instance already exists. #

I have no idea how to show QQmlApplicationEngine window in Maya..Many people use QQuickView.show() but I found QQmlApplicationEngine is more powerful than QQuickView.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/27876642-e29c-4aa7-b323-7d17fc80ec62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Israel
2018-07-30 20:35:30 UTC
Permalink
Post by Ruchit Bhatt
I did few test with QQMLAPPLICATIONENGINE outside Maya & everything works
fine. Problem with Maya is, If I use
app = QApplication(sys.argv)
Maya give a error
# Error: RuntimeError: A QApplication instance already exists. #
I have no idea how to show QQmlApplicationEngine window in Maya..Many
people use QQuickView.show() but I found QQmlApplicationEngine is more
powerful than QQuickView.
Maya already has a QApplication instance running. So I would think you just
create the engine and load your file.
Post by Ruchit Bhatt
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/27876642-e29c-4aa7-b323-7d17fc80ec62%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1s86ebYpxnHGFPVfP5jUpWWC8uO9GXQ%2BoTD0Y_MVw1Ew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...