void test2::InitListWideget()

{

  m_pList = new rootDataList(this);

  m_pList->setGeometry(LIST_X, LIST_Y, LIST_W, LIST_H);

QString  str;

  for(int i = 0; i<10; i++)

  {

    str.setNum(i);

     QListWidgetItem * pItem = new QListWidgetItem;

     pItem->setSizeHint(QSize(60, 22));  //每次改变Item的高度

     pItem->setText("大节点" + str);

    // m_pList->addItem(pItem);

    m_pList->insertItem(i, pItem);

  }

}

在QListWidget中保存的都是QListWidgetItem,通过每次改变QListWidgetItem的大小,插入QListWidget中,改变行高。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2021-04-03
  • 2022-12-23
  • 2021-08-02
猜你喜欢
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
相关资源
相似解决方案