コード例 #1
0
ファイル: Icons.java プロジェクト: perok/it1901_sheep
  private void createImagesGroupBox() {
    imagesGroupBox = new QGroupBox(tr("Images"));

    imagesTable = new QTableWidget();
    imagesTable.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection);
    imagesTable.setItemDelegate(new ImageDelegate(this));

    List<String> labels = new LinkedList<String>();
    labels.add(tr("Image"));
    labels.add(tr("Mode"));
    labels.add(tr("State"));

    imagesTable.horizontalHeader().setDefaultSectionSize(90);
    imagesTable.setColumnCount(3);
    imagesTable.setHorizontalHeaderLabels(labels);
    imagesTable.horizontalHeader().setResizeMode(0, QHeaderView.ResizeMode.Stretch);
    imagesTable.horizontalHeader().setResizeMode(1, QHeaderView.ResizeMode.Fixed);
    imagesTable.horizontalHeader().setResizeMode(2, QHeaderView.ResizeMode.Fixed);
    imagesTable.verticalHeader().hide();

    imagesTable.itemChanged.connect(this, "changeIcon()");

    QVBoxLayout layout = new QVBoxLayout();
    layout.addWidget(imagesTable);
    imagesGroupBox.setLayout(layout);
  }
コード例 #2
0
  void changeWidth() {
    Integer newWidth =
        QInputDialog.getInteger(
            this,
            tr("Change table width"),
            tr("Input the number of columns required (1-20):"),
            tableWidget.columnCount(),
            1,
            20,
            1);

    if (newWidth != null) tableWidget.setColumnCount(newWidth);
  }
コード例 #3
0
  void setupTableItems() {
    // ! [1]
    tableWidget.setRowCount(10);
    tableWidget.setColumnCount(5);
    // ! [1]

    for (int row = 0; row < tableWidget.rowCount(); ++row) {
      for (int column = 0; column < tableWidget.columnCount(); ++column) {
        // ! [2]
        QTableWidgetItem newItem = new QTableWidgetItem("" + (row + 1) + ", " + (column + 1));
        tableWidget.setItem(row, column, newItem);
        // ! [2]
      }
    }
  }
コード例 #4
0
 void retranslateUi(QWidget AnalisisForm) {
   AnalisisForm.setWindowTitle(
       com.trolltech.qt.core.QCoreApplication.translate("AnalisisForm", "Form", null));
   tableWidget.clear();
   tableWidget.setColumnCount(0);
   tableWidget.setRowCount(0);
   groupBox.setTitle(
       com.trolltech.qt.core.QCoreApplication.translate("AnalisisForm", "Acciones", null));
   pasosButton.setText(
       com.trolltech.qt.core.QCoreApplication.translate("AnalisisForm", "Pasos", null));
   completoButton.setText(
       com.trolltech.qt.core.QCoreApplication.translate("AnalisisForm", "Completo", null));
   groupBox_2.setTitle("");
   cerrarButton.setText(
       com.trolltech.qt.core.QCoreApplication.translate("AnalisisForm", "Cerrar", null));
 } // retranslateUi