[Qt-interest] QItemDelegate

Qrikg macos_user at yahoo.com
Fri Feb 19 10:57:23 CET 2010


Hello,
I've a table and different QTableWidgetItems    
int itemtables::createTable()
{
    m_pTable->setColumnReadOnly ( nCol, true); 
    m_pTable->setPixmap (nRow, nCol++, getAcqModePixmap(strMode));

    m_pTable->setColumnReadOnly ( nCol, true); 
    m_pTable->setText(nRow, nCol++, strMode);
    m_pTable->setItemDelegate(new itemDelegate(this););

    sb = new oCSpin( m_pSSetupTable, spinExposurePhoto, 0.0f, -1.0, QTableWidgetItem::Never );
    m_pSequentialSetupTable->setItem( nRow, nCol, sb );
    m_pSequentialSetupTable->setText(nRow, nCol, strExpValue);

    ci = new oCombo(binningPhoto);
    ci->setFlags(Qt::NoItemFlags);
    m_pSequentialSetupTable->setItem( nRow, nCol, ci );
    m_pSequentialSetupTable->setText(nRow, nCol++, strBinningVal);
}
class oCombo : public QTableWidgetItem
{
----------
};
class oCSpin : public QTableWidgetItem
{
----------
};
oCombo::oCombo(QComboBox *pExtCb)
    : QTableWidgetItem(), pCb( 0 )
{
---
}

oCSpin ::oCSpin (QComboBox *pExtCb)
    : QTableWidgetItem(), pCb( 0 )
{
---
}

class itemDelegate : public QItemDelegate
{
   Q_OBJECT
      
public:
  itemDelegate(QObject *parent = 0);

  virtual QWidget *createEditor( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
};

itemDelegate::itemDelegate(QObject *parent = 0)
{
}
QWidget * itemDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
}

In createEditor(),i've to set some properties for each tableWidgetItem,how can i access corresponding tableWidgetItem,(ie,oCombo ,oCSpin),in  itemDelegate::createEditor


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100219/4b0114e2/attachment.html 


More information about the Qt-interest-old mailing list