zoukankan      html  css  js  c++  java
  • QComboBox和QTableWidget配合使用

    //创建下拉框对象,并加入到表格对象中 
    QComboBox *comboBox = new QComboBox (); comboBox ->addItems(strListItems);//QStringList类型的元素 m_Table->setCellWidget(0,0,comboBox );//把下拉框加入到表格中
    //如果表格的一行中既有QComboBox 类型的元素,也有QTableWidgetItem类型的元素,可以采用下面的方式来用: for(int col = 0; col < count; col++) {   if( QComboBox *comboBox = dynamic_cast<QComboBox *>(table->cellWidget(0, col))   {     comboBox->setCurrentIndex(index);//让下拉框选到index对应的位置   }   else   {     table->setItem(0,col,new QTableWidgetItem("value");   } }
  • 相关阅读:
    Python 基础(二)
    Python 入门
    DNS
    PXE自动化安装CentOS7和CentOS6
    AIDE及sudo应用
    SSH应用
    KickStart自动化安装Linux
    初见鸟哥
    数组ARRAY
    SSH用法
  • 原文地址:https://www.cnblogs.com/Stephen-Qin/p/13227455.html
Copyright © 2011-2022 走看看