예제 #1
0
    public UpdatePage(QWidget parent) {
      super(parent);
      QGroupBox updateGroup = new QGroupBox(tr("Package selection"));
      QCheckBox systemCheckBox = new QCheckBox(tr("Update system"));
      QCheckBox appsCheckBox = new QCheckBox(tr("Update applications"));
      QCheckBox docsCheckBox = new QCheckBox(tr("Update documentation"));

      QGroupBox packageGroup = new QGroupBox(tr("Existing packages"));

      QListWidget packageList = new QListWidget();
      QListWidgetItem qtItem = new QListWidgetItem(packageList);
      qtItem.setText(tr("Qt"));
      QListWidgetItem qsaItem = new QListWidgetItem(packageList);
      qsaItem.setText(tr("QSA"));
      QListWidgetItem teamBuilderItem = new QListWidgetItem(packageList);
      teamBuilderItem.setText(tr("Teambuilder"));

      QPushButton startUpdateButton = new QPushButton(tr("Start update"));

      QVBoxLayout updateLayout = new QVBoxLayout();
      updateLayout.addWidget(systemCheckBox);
      updateLayout.addWidget(appsCheckBox);
      updateLayout.addWidget(docsCheckBox);
      updateGroup.setLayout(updateLayout);

      QVBoxLayout packageLayout = new QVBoxLayout();
      packageLayout.addWidget(packageList);
      packageGroup.setLayout(packageLayout);

      QVBoxLayout mainLayout = new QVBoxLayout();
      mainLayout.addWidget(updateGroup);
      mainLayout.addWidget(packageGroup);
      mainLayout.addSpacing(12);
      mainLayout.addWidget(startUpdateButton);
      mainLayout.addStretch(1);
      setLayout(mainLayout);
    }
예제 #2
0
  private void createIcons() {
    QListWidgetItem configButton = new QListWidgetItem(contentsWidget);
    configButton.setIcon(new QIcon("classpath:com/trolltech/examples/images/config.png"));
    configButton.setText(tr("Configuration"));
    configButton.setTextAlignment(AlignmentFlag.AlignHCenter.value());
    configButton.setFlags(ItemFlag.ItemIsSelectable, ItemFlag.ItemIsEnabled);

    QListWidgetItem updateButton = new QListWidgetItem(contentsWidget);
    updateButton.setIcon(new QIcon("classpath:com/trolltech/examples/images/update.png"));
    updateButton.setText(tr("Update"));
    updateButton.setTextAlignment(AlignmentFlag.AlignHCenter.value());
    updateButton.setFlags(ItemFlag.ItemIsSelectable, ItemFlag.ItemIsEnabled);

    QListWidgetItem queryButton = new QListWidgetItem(contentsWidget);
    queryButton.setIcon(new QIcon("classpath:com/trolltech/examples/images/query.png"));
    queryButton.setText(tr("Query"));
    queryButton.setTextAlignment(AlignmentFlag.AlignHCenter.value());
    queryButton.setFlags(ItemFlag.ItemIsSelectable, ItemFlag.ItemIsEnabled);

    contentsWidget.currentItemChanged.connect(
        this, "changePage(QListWidgetItem , QListWidgetItem)");
  }