Exemple #1
0
  @SuppressWarnings("unused")
  private void currentChanged(QModelIndex current, QModelIndex old) {
    QWidget prev = (QWidget) ui.verticalLayoutWidget.findChild(PBFileWidget.class);
    if (prev != null) {
      ui.verticalLayout.removeWidget((QWidget) prev);
      prev.close();
      prev.dispose();
    }

    currentFile = (PBFile) fileListModel.data(current, ItemDataRole.UserRole);
    if (currentFile == null) return;

    if (ui.right != null) ui.right.hide();

    PBFileWidget w = new PBFileWidget(ui.verticalLayoutWidget, currentFile);
    ui.verticalLayout.addWidget(w);
    ui.verticalLayout.update();
  }
  public void delete() {
    boolean status = Controller.getInstance().deleteStudent(_id);
    QMessageBox t = new QMessageBox();
    t.setWindowIcon(new QIcon(new QPixmap("classpath:admin_resource/eot_icon.png")));

    if (status) {
      holder.hide();
      holder.close();
      t.setText("The deletion was a success");
      t.setWindowTitle("Success");
      t.exec();
      // Controller.getInstance().work();
    } else {
      t.setText("The deletion failed");
      t.setWindowTitle("Failed");
      t.exec();
      // Controller.getInstance().work();
    }
  }