public static void main(String args[]) { QApplication.initialize(args); // ! [0] QLabel label = new QLabel(); label.setFrameStyle(QFrame.Shadow.Sunken.value() | QFrame.Shape.Panel.value()); label.setText("first line\nsecond line"); label.setAlignment(Qt.AlignmentFlag.AlignBottom, Qt.AlignmentFlag.AlignRight); // ! [0] // ! [1] QLineEdit phoneEdit = new QLineEdit(); QLabel phoneLabel = new QLabel("Phone:"); phoneLabel.setBuddy(phoneEdit); // ! [1] // ! [2] QLineEdit nameEd = new QLineEdit(); QLabel nameLb = new QLabel("Name:"); nameLb.setBuddy(nameEd); QLineEdit phoneEd = new QLineEdit(); QLabel phoneLb = new QLabel("Phone:"); phoneLb.setBuddy(phoneEd); // (layout setup not shown) // ! [2] }
public dragwidget(QWidget parent) { super(parent); setFrameStyle(QFrame.Shape.StyledPanel.value() | QFrame.Shadow.Sunken.value()); dragDropLabel = new QLabel("", this); dragDropLabel.setAlignment(new Qt.Alignment(Qt.AlignmentFlag.AlignHCenter)); QHBoxLayout layout = new QHBoxLayout(this); layout.addStretch(0); layout.addWidget(dragDropLabel); layout.addStretch(0); setAcceptDrops(true); }