Earlier I posted a bit of code for a Signal quality widget, which just takes a
number 1-5 and draws cell-phone style bars.
I have this working in Qt but it does not seem to work in Wt. What am I doing
wrong?
class SignalQualityDelegate: public QItemDelegate
{
int value;
PWidget *createEditor(const WModelIndex& index, WFlags<ViewItemRenderFlag>
flags) const
{
Q_CONST_UNUSED(index)
Q_UNUSED(flags)
WPaintedWidget *pw = dynamic_cast<WPaintedWidget*>(new
SignalQualityWidget());
return pw;
}
void setEditState (WWidget *editor, const QVariant &value) const
{
SignalQualityWidget *bars = UPCAST(SignalQualityWidget*, editor);
if (bars) bars->setValue (boost::any_cast<int>(value));
}
}
In the Form cosntructor:
ui->tableView->setItemDelegateForColumn(NetworkAcceptListModel::SignalColumn,
new SignalQualityDelegate());
NetworkAcceptListModel *model = new NetworkAcceptListModel(this);
ui->tableView->setModel(model);
for (int i=0; i<10; i++)
{
NetworkAcceptItem *item = new NetworkAcceptItem();
item->address = i;
item->asset = QString(assetGroup).arg(i);
item->device = QString (modelNumber);
item->name = QString("Name %1").arg(i);
item->signalStrength = i%6;
model->addItem(item);
}
class NetworkAcceptListModel : public QAbstractTableModel {
... // this works in Qt so I'll assume its valid here // ...
}
Any help?
------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and
improve service delivery. Take 5 minutes to use this Systems Optimization
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest