Example #1
0
  // ! [1]
  public Sliders() {
    horizontalSliders = new SlidersGroup(Qt.Orientation.Horizontal, tr("Horizontal"));
    verticalSliders = new SlidersGroup(Qt.Orientation.Vertical, tr("Vertical"));

    stackedWidget = new QStackedWidget();
    stackedWidget.addWidget(horizontalSliders);
    stackedWidget.addWidget(verticalSliders);

    createControls(tr("Controls"));
    // ! [1] //! [2]

    horizontalSliders.valueChanged.connect(verticalSliders, "setValue(int)");
    verticalSliders.valueChanged.connect(valueSpinBox, "setValue(int)");
    valueSpinBox.valueChanged.connect(horizontalSliders, "setValue(int)");

    QHBoxLayout layout = new QHBoxLayout();
    layout.addWidget(controlsGroup);
    layout.addWidget(stackedWidget);
    setLayout(layout);

    minimumSpinBox.setValue(0);
    maximumSpinBox.setValue(20);
    valueSpinBox.setValue(5);

    setWindowTitle(tr("Sliders"));
  }
  // ! [0]
  public FindFiles() {
    browseButton = createButton(tr("&Browse..."), "browse()");
    findButton = createButton(tr("&Find"), "find()");

    fileComboBox = createComboBox(tr("*"));
    textComboBox = createComboBox("");
    directoryComboBox = createComboBox(QDir.currentPath());

    fileLabel = new QLabel(tr("Named:"));
    textLabel = new QLabel(tr("Containing text:"));
    directoryLabel = new QLabel(tr("In directory:"));
    filesFoundLabel = new QLabel();

    createFilesTable();
    // ! [0]

    // ! [1]
    QHBoxLayout buttonsLayout = new QHBoxLayout();
    buttonsLayout.addStretch();
    buttonsLayout.addWidget(findButton);

    QGridLayout mainLayout = new QGridLayout();
    mainLayout.addWidget(fileLabel, 0, 0);
    mainLayout.addWidget(fileComboBox, 0, 1, 1, 2);
    mainLayout.addWidget(textLabel, 1, 0);
    mainLayout.addWidget(textComboBox, 1, 1, 1, 2);
    mainLayout.addWidget(directoryLabel, 2, 0);
    mainLayout.addWidget(directoryComboBox, 2, 1);
    mainLayout.addWidget(browseButton, 2, 2);
    mainLayout.addWidget(filesTable, 3, 0, 1, 3);
    mainLayout.addWidget(filesFoundLabel, 4, 0);
    mainLayout.addLayout(buttonsLayout, 5, 0, 1, 3);
    setLayout(mainLayout);

    setWindowTitle(tr("Find Files"));
    resize(700, 300);
  }