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]

  }
Exemplo n.º 2
0
 private QLabel createPixmapLabel() {
   QLabel label = new QLabel();
   label.setEnabled(false);
   label.setAlignment(Qt.AlignmentFlag.AlignCenter);
   label.setFrameShape(QFrame.Shape.Box);
   label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding);
   label.setBackgroundRole(QPalette.ColorRole.Base);
   label.setAutoFillBackground(true);
   label.setMinimumSize(132, 132);
   return label;
 }
  protected MyAbstractDockWidget(String title) {

    super(title);

    setFeatures(DockWidgetFeature.DockWidgetMovable);

    label = new QLabel("Move me!");
    label.setContentsMargins(50, 50, 50, 50);
    label.setAlignment(AlignmentFlag.AlignCenter);

    setWidget(label);
  }
Exemplo n.º 4
0
  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);
  }
  public QDockWidgetLocationChangedBug() {

    resize(640, 400);

    final QLabel label = new QLabel("Central widget");
    label.setAlignment(AlignmentFlag.AlignCenter);
    label.setFrameShadow(Shadow.Plain);
    label.setFrameShape(Shape.Panel);
    setCentralWidget(label);

    addDockWidget(DockWidgetArea.LeftDockWidgetArea, new MyBadDockWidget());
    addDockWidget(DockWidgetArea.RightDockWidgetArea, new MyGoodDockWidget());

    show();
  }
Exemplo n.º 6
0
 private void initUI() {
   final QHBoxLayout mainHbox = new QHBoxLayout();
   {
     final QGroupBox videoBox = new QGroupBox(Strings.grpRenderingVideoFrames);
     final QVBoxLayout videoVbox = new QVBoxLayout();
     {
       final QHBoxLayout hbox = new QHBoxLayout();
       hbox.addWidget(new QLabel(Strings.lblLastFrameProcessed));
       lblLastFrameProcessed = new QLabel(Strings.lblLastFrameProcessedDefault);
       lblLastFrameProcessed.setAlignment(AlignmentFlag.AlignRight);
       hbox.addWidget(lblLastFrameProcessed);
       videoVbox.addLayout(hbox, 0);
     }
     {
       final QHBoxLayout hbox = new QHBoxLayout();
       hbox.addWidget(new QLabel(Strings.lblFramesProcessedPerSecond));
       lblFramesProcessedPerSecond = new QLabel(Strings.lblFramesProcessedPerSecondDefault);
       lblFramesProcessedPerSecond.setAlignment(AlignmentFlag.AlignRight);
       hbox.addWidget(lblFramesProcessedPerSecond);
       videoVbox.addLayout(hbox, 0);
     }
     {
       final QHBoxLayout hbox = new QHBoxLayout();
       hbox.addWidget(new QLabel(Strings.lblLastFrameSaved));
       lblLastFrameSaved = new QLabel(Strings.lblLastFrameSavedDefault);
       lblLastFrameSaved.setAlignment(AlignmentFlag.AlignRight);
       hbox.addWidget(lblLastFrameSaved);
       videoVbox.addLayout(hbox, 0);
     }
     {
       previewPicture =
           new UpdatablePicture(
               Files.iconRenderingDefault, maximumPreviewWidth, maximumPreviewHeight);
       videoVbox.addWidget(previewPicture, 1);
     }
     {
       previewEnabledCheckbox = new QCheckBox(Strings.lblEnablePreview);
       previewEnabledCheckbox.stateChanged.connect(this, "updatePreviewEnabled()");
       previewEnabled = getSettings().getPreviewEnabled();
       previewEnabledCheckbox.setChecked(previewEnabled);
       videoVbox.addWidget(previewEnabledCheckbox, 0, AlignmentFlag.AlignHCenter);
     }
     videoBox.setLayout(videoVbox);
     mainHbox.addWidget(videoBox, 1);
   }
   {
     final QGroupBox audioBox = new QGroupBox(Strings.grpRenderingAudioBuffer);
     final QVBoxLayout audioVbox = new QVBoxLayout();
     {
       audioBuffer = new QProgressBar();
       audioBuffer.setOrientation(Orientation.Vertical);
       audioBuffer.setSizePolicy(Policy.Expanding, Policy.Expanding);
       audioVbox.addWidget(audioWidget(audioBuffer), 1, AlignmentFlag.AlignHCenter);
       lblAudioBuffer1 = new QLabel();
       audioVbox.addWidget(audioWidget(lblAudioBuffer1), 0, AlignmentFlag.AlignCenter);
       lblAudioBuffer2 = new QLabel();
       audioVbox.addWidget(audioWidget(lblAudioBuffer2), 0, AlignmentFlag.AlignCenter);
       btnFlushAudioBuffer = new QPushButton(Strings.btnRenderAudioBufferFlush);
       btnFlushAudioBuffer.clicked.connect(this, "onFlushAudioBuffer()");
       btnFlushAudioBuffer.setEnabled(false);
       audioVbox.addWidget(audioWidget(btnFlushAudioBuffer), 0, AlignmentFlag.AlignCenter);
     }
     audioBox.setLayout(audioVbox);
     mainHbox.addWidget(audioBox, 0);
   }
   setLayout(mainHbox);
 }
Exemplo n.º 7
0
 private QLabel createHeaderLabel(String text) {
   QLabel label = new QLabel(tr("<b>" + text + "</b>"));
   label.setAlignment(Qt.AlignmentFlag.AlignCenter);
   return label;
 }