I have successfully built my multi tab gui in Qt Creator but I don't know how do I implement it in the code. I already have my plugin files. I generated them using Plugin Builder. So how do I implement it from there?
1 Answer
You will need to load your qt ui file to a Python class. If you use the Plugin Builder with template "Tool button with dialog" it will show you the entire code. From the Sherman builder:
import os
from qgis.PyQt import uic
from qgis.PyQt import QtWidgets
# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'photo_linker_dialog_base.ui'))
class PhotoLinkerDialog(QtWidgets.QDialog, FORM_CLASS):
def __init__(self, parent=None):
"""Constructor."""
super(PhotoLinkerDialog, self).__init__(parent)
# Set up the user interface from Designer through FORM_CLASS.
# After self.setupUi() you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)