Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue with using 'promote to' in QtDesigner with PyQt5

Issue with using 'promote to' in QtDesigner with PyQt5

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 365 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kprice
    wrote on last edited by kprice
    #1

    I've created a object called ImageViewer that inherits from QStackedImage. I wanted to use the 'promote to' function in QtDesigner to change my current QStackedImage to a ImageViewer object. I was a little confused about it asking for a header file in python for a while but eventually I figured it out. It imported correctly and even created a .pyc file which means it imported and compiled it correctly. The problem arises in my code when I try to set up the UI. A snippet is shown below.

    qtCreatorFile = "EITDaq2.ui"
    Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)

    class DAQView(QtWidgets.QMainWindow, Ui_MainWindow):

    def __init__(self, model):
        # qt required window init stuff (from double inheritance)
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
    

    On the command 'self.setupUi(self)' I get the error:

    self.setupUi(self)
    File "<string>", line 257, in setupUi
    TypeError: __init__() takes exactly 1 argument (2 given)
    

    It seems like I'm passing it 1 parameter but maybe when I promote the new ImageViewer object into the ui file it makes it into a sister widget to the main window instead of a child widget so it's like passing in two parameters to the ui builder. I've checked all over the forum and haven't found anything. Much appreciation for any insight.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved