Hi,
I have some widgets (see pic) and im trying to put a border around them all.
The code below is adding the border around all the widgets individually instead of globally.
What am I doing wrong? How to I get the result seem in the example image?

thanks

Qt Code:
  1. Class myFrame(QFrame):
  2. def __init__(self):
  3. super(myFrame, self).__init__()
  4.  
  5. self.setStyleSheet("border: 1px solid black")
  6. self.label = QLabel('Tracker01')
  7. self.setMinimumWidth(60)
  8. self.label.setMaximumWidth(100)
  9. self.colorSwatch = QFrame()
  10. self.colorSwatch.setFixedWidth(20)
  11. self.colorSwatch.setFixedHeight(20)
  12. self.colorSwatch.setStyleSheet("border: 1px solid black")
  13.  
  14. self.X_LineEdit = QLineEdit()
  15. self.Y_LineEdit = QLineEdit()
  16. self.Z_LineEdit = QLineEdit()
  17. self.X_LineEdit.setMaximumWidth(60)
  18. self.Y_LineEdit.setMaximumWidth(60)
  19. self.Z_LineEdit.setMaximumWidth(60)
  20.  
  21. self.X_Label = QLabel('x')
  22. self.Y_Label = QLabel('y')
  23. self.Z_Label = QLabel('z')
  24. self.X_Label.setMaximumWidth(10)
  25. self.Y_Label.setMaximumWidth(10)
  26. self.Z_Label.setMaximumWidth(10)
  27.  
  28.  
  29. self.CopyValues = QPushButton('Cp')
  30. self.CreateCard = QPushButton('Cr')
  31. self.MarkPoint = QPushButton('Mk')
  32. self.CopyValues.setMaximumWidth(30)
  33. self.CreateCard.setMaximumWidth(30)
  34. self.MarkPoint.setMaximumWidth(30)
  35.  
  36. self.layout = QHBoxLayout()
  37. self.layout.addWidget(self.label)
  38. self.layout.addWidget(self.colorSwatch)
  39. self.layout.addWidget(self.X_Label)
  40. self.layout.addWidget(self.X_LineEdit)
  41. self.layout.addWidget(self.Y_Label)
  42. self.layout.addWidget(self.Y_LineEdit)
  43. self.layout.addWidget(self.Z_Label)
  44. self.layout.addWidget(self.Z_LineEdit)
  45. self.layout.addWidget(self.CreateCard)
  46. self.layout.addWidget(self.CopyValues)
  47. self.layout.addWidget(self.MarkPoint)
  48.  
  49. self.setLayout(self.layout)
  50.  
  51.  
  52. class myPanel(QDialog):
  53. def __init__(self):
  54. super(myPanel, self).__init__()
  55.  
  56. self.masterLayout = QGridLayout()
  57. self.masterLayout.addWidget(myFrame(),0,0)
  58. self.masterLayout.addWidget(myFrame(),1,0)
  59. self.setLayout(self.masterLayout)
To copy to clipboard, switch view to plain text mode 


ex1.JPG
ex2.JPG