Exemplo n.º 1
0
  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);
  }
Exemplo n.º 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);
  }
Exemplo n.º 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]
      }
    }
  }
Exemplo n.º 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
    public ProgramTab() {
      QHBoxLayout mainLayout = new QHBoxLayout();
      QTableWidget table = new QTableWidget(this);
      table.setColumnCount(1);
      table.setColumnWidth(0, this.width());
      table.setRowCount(128);
      List<String> labels = new ArrayList<String>();
      for (int i = 0; i < 128; i++) {
        labels.add(String.valueOf(i));
      }
      table.setVerticalHeaderLabels(labels);
      List<String> labels1 = new ArrayList<String>();
      labels1.add("Instructions");
      table.setHorizontalHeaderLabels(labels1);
      table.setSelectionMode(SelectionMode.SingleSelection);
      table.setSelectionBehavior(SelectionBehavior.SelectItems);
      for (int i = 0; i < 128; i++) {
        //				for(int j=0; j<10; j++){
        //					wigitem = new QTableWidgetItem((i)+""+(j));
        int address = (i);
        if (address < 128) {
          wigitem =
              new QTableWidgetItem(
                  simulation
                      .getProgramMemory()
                      .readByte(address)
                      .getValueAsPreferredRepresentation());
          table.setItem(i, 0, wigitem);
        }
      }
      table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers);
      //			table.setGeometry(100, 100, table.width()+390, table.height()-17);
      table.setWindowTitle("Program Memory Table");
      table.setWindowModality(WindowModality.WindowModal);

      mainLayout.addWidget(table);
      resize(table.width(), table.height());
      setLayout(mainLayout);
    }