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 #2
0
  private void createIconSizeGroupBox() {
    iconSizeGroupBox = new QGroupBox(tr("Icon Size"));

    smallRadioButton = new QRadioButton();
    largeRadioButton = new QRadioButton();
    toolBarRadioButton = new QRadioButton();
    listViewRadioButton = new QRadioButton();
    iconViewRadioButton = new QRadioButton();
    tabBarRadioButton = new QRadioButton();
    otherRadioButton = new QRadioButton(tr("Other:"));

    otherSpinBox = new IconSizeSpinBox();
    otherSpinBox.setRange(8, 128);
    otherSpinBox.setValue(64);

    smallRadioButton.toggled.connect(this, "changeSize(boolean)");
    largeRadioButton.toggled.connect(this, "changeSize(boolean)");
    toolBarRadioButton.toggled.connect(this, "changeSize(boolean)");
    listViewRadioButton.toggled.connect(this, "changeSize(boolean)");
    iconViewRadioButton.toggled.connect(this, "changeSize(boolean)");
    tabBarRadioButton.toggled.connect(this, "changeSize(boolean)");
    otherRadioButton.toggled.connect(this, "changeSize(boolean)");
    otherSpinBox.valueChanged.connect(this, "changeSize(int)");

    QHBoxLayout otherSizeLayout = new QHBoxLayout();
    otherSizeLayout.addWidget(otherRadioButton);
    otherSizeLayout.addWidget(otherSpinBox);
    otherSizeLayout.addStretch();

    QGridLayout layout = new QGridLayout();
    layout.addWidget(smallRadioButton, 0, 0);
    layout.addWidget(largeRadioButton, 1, 0);
    layout.addWidget(toolBarRadioButton, 2, 0);
    layout.addWidget(listViewRadioButton, 0, 1);
    layout.addWidget(iconViewRadioButton, 1, 1);
    layout.addWidget(tabBarRadioButton, 2, 1);
    layout.addLayout(otherSizeLayout, 3, 0, 1, 2);
    layout.setRowStretch(4, 1);
    iconSizeGroupBox.setLayout(layout);
  }