PDA

View Full Version : Combining two guis into one widget



KodinPanda
9th January 2020, 23:21
im trying to add my widget to another persons widget, we are both working on the same project but im not as adept in qt as he is and he is busy with another project, im trying to out how to add my widget to his, the My_widget is where my widget is suppose to go in his

self.centralWidget.setObjectName("centralWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralWidget)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.splitter_2 = QtWidgets.QSplitter(self.centralWidget)
self.splitter_2.setOrientation(QtCore.Qt.Horizonta l)
self.splitter_2.setObjectName("splitter_2")
self.My_Widget = QtWidgets.QWidget(self.splitter_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Prefer red, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.My_Widget.sizePo licy().hasHeightForWidth())
self.My_Widget.setSizePolicy(sizePolicy)
self.My_Widget.setMinimumSize(QtCore.QSize(200, 100))
self.My_Widget.setStyleSheet("background-color: rgb(200, 200, 200);\n"
"border: 3px solid grey;")
self.Jodies_Widget.setObjectName("My_Widget")

self.tabWidget = QtWidgets.QTabWidget(self.splitter_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expand ing, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tabWidget.sizePo licy().hasHeightForWidth())
self.tabWidget.setSizePolicy(sizePolicy)
self.tabWidget.setMinimumSize(QtCore.QSize(0, 0))
self.tabWidget.setStyleSheet("")
self.tabWidget.setTabBarAutoHide(False)
self.tabWidget.setObjectName("tabWidget")
self.tab_1 = QtWidgets.QWidget()
self.tab_1.setObjectName("tab_1")
self.gridLayout = QtWidgets.QGridLayout(self.tab_1)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label_33 = QtWidgets.QLabel(self.tab_1)
self.label_33.setStyleSheet("")
self.label_33.setObjectName("label_33")
self.verticalLayout_2.addWidget(self.label_33)
self.label_34 = QtWidgets.QLabel(self.tab_1)

d_stranz
10th January 2020, 00:46
If your "another person" is the forum user named "AzureSkgale", then the question has already been addressed. Reply to that thread, don't double post.

And as ChrisW67 said in his answer, it isn't clear at all which "two widgets" you want to "add" and how.

KodinPanda
10th January 2020, 01:00
not sure if he is he might but im trying to add the other widget by creating a button, i cant post everything due limitations on what can be sent i posted where i was stuck

d_stranz
10th January 2020, 17:01
OK, maybe it isn't the same person, but it is a bit suspicious when two posts under different user names contain identical code...

You have to understand that we have no idea from the piece of code you have both posted what you are trying to do, and we can't tell from the code what you expect your UI to look like. You have many widgets declared in your code - a "central widget" of some type, a QSplitter, several QWidget instances, a tab widget, two QLabel widgets, something called "Jodies_Widget", and a bunch of layouts.

So when you say you want to "add my widget to another person's widget" we have no clue what that means.