<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Trouble loading Qt ui file in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/9845705#M6141</link>
    <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to load a Qt ui file through python in Max, but it's not working for me. I'm following thi example I found in the docs...&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=Max_Python_API_creating_python_uis_html" target="_blank"&gt;http://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=Max_Python_API_creating_python_uis_html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(scroll down to&amp;nbsp;Loading Qt UI Files) (code pasted below as well)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made sure to create a 'test.ui' file with a QPushButton named 'pushButton' so that I could test the example as simply as possible. However, when I run this code I do not see the UI I created in Qt Designer. Instead&amp;nbsp; I just see an empty panel. I'd be grateful for anyone who can point out where I'm going wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
from PySide2.QtWidgets import QVBoxLayout
from PySide2.QtWidgets import QWidget
from PySide2.QtWidgets import QDialog
from PySide2.QtWidgets import QPushButton
from PySide2.QtCore import QFile
from PySide2.QtUiTools import QUiLoader
from pymxs import runtime as rt

class TestDialog(QDialog):
    def __init__(self, parent=QWidget.find(rt.windows.getMAXHWND())):
        QDialog.__init__(self, parent)
        loader = QUiLoader()
        ui_file_path = os.path.join(  os.path.dirname(os.path.realpath(__file__)), 'test_ui.ui')
        ui_file = QFile(ui_file_path)
        ui_file.open(QFile.ReadOnly)
        self.ui = loader.load(ui_file, self)
        ui_file.close()

        layout = QVBoxLayout()
        layout.addWidget(self.ui)
        self.setLayout(layout)
        btn = self.ui.findChild(QPushButton, 'pushButton')
        btn.clicked.connect(self.makeTeapot)

    def makeTeapot(self):
        rt.teapot()
        rt.redrawViews()

def main():
    dlg = TestDialog()
    dlg.show()

if __name__ == '__main__':
    main()&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 04 Nov 2020 16:29:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-04T16:29:10Z</dc:date>
    <item>
      <title>Trouble loading Qt ui file</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/9845705#M6141</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to load a Qt ui file through python in Max, but it's not working for me. I'm following thi example I found in the docs...&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=Max_Python_API_creating_python_uis_html" target="_blank"&gt;http://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=Max_Python_API_creating_python_uis_html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(scroll down to&amp;nbsp;Loading Qt UI Files) (code pasted below as well)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made sure to create a 'test.ui' file with a QPushButton named 'pushButton' so that I could test the example as simply as possible. However, when I run this code I do not see the UI I created in Qt Designer. Instead&amp;nbsp; I just see an empty panel. I'd be grateful for anyone who can point out where I'm going wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
from PySide2.QtWidgets import QVBoxLayout
from PySide2.QtWidgets import QWidget
from PySide2.QtWidgets import QDialog
from PySide2.QtWidgets import QPushButton
from PySide2.QtCore import QFile
from PySide2.QtUiTools import QUiLoader
from pymxs import runtime as rt

class TestDialog(QDialog):
    def __init__(self, parent=QWidget.find(rt.windows.getMAXHWND())):
        QDialog.__init__(self, parent)
        loader = QUiLoader()
        ui_file_path = os.path.join(  os.path.dirname(os.path.realpath(__file__)), 'test_ui.ui')
        ui_file = QFile(ui_file_path)
        ui_file.open(QFile.ReadOnly)
        self.ui = loader.load(ui_file, self)
        ui_file.close()

        layout = QVBoxLayout()
        layout.addWidget(self.ui)
        self.setLayout(layout)
        btn = self.ui.findChild(QPushButton, 'pushButton')
        btn.clicked.connect(self.makeTeapot)

    def makeTeapot(self):
        rt.teapot()
        rt.redrawViews()

def main():
    dlg = TestDialog()
    dlg.show()

if __name__ == '__main__':
    main()&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 04 Nov 2020 16:29:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/9845705#M6141</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-04T16:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble loading Qt ui file</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/9845984#M6142</link>
      <description>&lt;P&gt;OK, figured out what I was doing wrong. I created my ui file as a QDialog. By making a ui file as a QWidget, this works as expected. Oh the process of learning...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 18:26:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/9845984#M6142</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-04T18:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble loading Qt ui file</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/10586343#M6143</link>
      <description>&lt;P&gt;Hi, I might have the same issue like yours when I try to load ui file in 3ds max, kinda new, just don't understand what is "making ui file as a QWidget", can you explain more about it ? pls...&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 03:43:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/10586343#M6143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-31T03:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble loading Qt ui file</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/11967242#M6144</link>
      <description>&lt;P&gt;I got the same problem.&amp;nbsp; I believe @Anonymous&amp;nbsp;was saying when creating a ui file in Qt Designer, you have to choose "Widget" instead of any other templates at the very first.&amp;nbsp; I solved the problem by changing my&lt;BR /&gt;"Main Window" ui file to "Widget" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luna_Gu98_0-1684239973799.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1215049iB91819532D00AB0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luna_Gu98_0-1684239973799.png" alt="Luna_Gu98_0-1684239973799.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 12:27:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/trouble-loading-qt-ui-file/m-p/11967242#M6144</guid>
      <dc:creator>Luna_Gu98</dc:creator>
      <dc:date>2023-05-16T12:27:33Z</dc:date>
    </item>
  </channel>
</rss>

