Exemple #1
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;
 }
  void setData(String mimetype, QByteArray newData) {
    mimeType = mimetype;
    data = new QByteArray(newData);

    dragDropLabel.setText(String.valueOf(data.size()) + " bytes.");

    List<String> formats = new Vector<String>();
    formats.add(mimetype);
    mimeTypes.emit(formats);
  }
  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);
  }
Exemple #4
0
 private QLabel createHeaderLabel(String text) {
   QLabel label = new QLabel(tr("<b>" + text + "</b>"));
   label.setAlignment(Qt.AlignmentFlag.AlignCenter);
   return label;
 }