コード例 #1
0
  public void updateCounts(Integer cnt) {
    QBrush gray = new QBrush();
    gray.setColor(QColor.gray);
    QBrush black = new QBrush();
    black.setColor(QColor.black);

    trashCount = cnt;
    trashItem.setText(1, trashCount.toString());
    header().resizeSection(1, 0);
    if (trashCount > 0) {
      trashItem.setForeground(0, black);
      trashItem.setForeground(1, black);
    } else {
      trashItem.setForeground(0, gray);
      trashItem.setForeground(1, gray);
    }
  }
コード例 #2
0
 public void load() {
   String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
   QIcon trashIcon = new QIcon(iconPath + "trash.png");
   trashItem = new QTreeWidgetItem();
   trashItem.setIcon(0, trashIcon);
   trashItem.setText(0, "Trash");
   Qt.Alignment ra = new Qt.Alignment(Qt.AlignmentFlag.AlignRight);
   trashItem.setTextAlignment(1, ra.value());
   List<String> headers = new ArrayList<String>();
   headers.add("");
   headers.add("");
   setHeaderLabels(headers);
   setColumnCount(2);
   header().setResizeMode(0, QHeaderView.ResizeMode.ResizeToContents);
   header().setResizeMode(1, QHeaderView.ResizeMode.Stretch);
   header().setMovable(false);
   setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection);
   addTopLevelItem(trashItem);
 }