ControlElement buffer2CElem(const utils::Buffer& b)
{
    utils::IBufferStream is(b);

    utils::String name;
    int nodeID, inputIndex;
    Point p;
    utils::String widgetType;

    is >> name >> nodeID >> inputIndex >> widgetType >> p;

    std::string allText(reinterpret_cast<const char*>(b.getPtr()),
                        b.getLen());

    std::string::size_type pos = allText.find('|');

    utils::StructReader::ConfigMap params;
    if (pos != std::string::npos)
    {
        allText = allText.substr(pos+1);
        utils::StructReader sr(allText);

        params = sr.getMap();
    }

    return ControlElement(name, p, nodeID, inputIndex, widgetType, params);
}
 virtual QString text(int col) const
 {
     if (col == 2 || col == 3 || col == 4)
         return FormatTime(allText(col).toDouble() / 1E9);
     else
         return toResultViewItem::text(col);
 }
        virtual void paintCell(QPainter *p, const QColorGroup &cg,
                               int column, int width, int alignment)
        {
#if 0                           // disabled - not overriding correct method
            if (column == 2)
            {
                toProfilerUnits *units = dynamic_cast<toProfilerUnits *>(listView());
                if (!units)
                {
                    toTreeWidgetItem::paintCell(p, cg, column, width, alignment);
                    return ;
                }
                double total = allText(column).toDouble();
                QString timstr = FormatTime(total / 1E9);
                double val = total / units->total();

                p->fillRect(0, 0, int(val*width), height(), QBrush(Qt::blue));
                p->fillRect(int(val*width), 0, width, height(),
                            QBrush(isSelected() ? cg.highlight() : cg.base()));

                QPen pen(isSelected() ? cg.highlightedText() : cg.foreground());
                p->setPen(pen);
                p->drawText(0, 0, width, height(), Qt::AlignRight, timstr);
            }
            else
            {
                toTreeWidgetItem::paintCell(p, cg, column, width, alignment);
            }
#endif
        }
        virtual void paintCell(QPainter *p, const QColorGroup &cg,
                               int column, int width, int alignment)
        {
#if 0                           // disabled - not overriding correct class
            if (column == 1 || column == 2 || column == 3 || column == 4)
            {
                toProfilerSource *source = dynamic_cast<toProfilerSource *>(listView());
                if (!source)
                {
                    toTreeWidgetItem::paintCell(p, cg, column, width, alignment);
                    return ;
                }
                double total = allText(column).toDouble();
                double val;
                switch (column)
                {
                case 1:
                    val = total / source->TotalOccur;
                    break;
                case 2:
                    val = total / source->TotalTime;
                    break;
                case 3:
                    val = total / source->MaxTime;
                    break;
                case 4:
                    val = total / source->MinTime;
                    break;
                default:
                    val = 0;
                }

                p->fillRect(0, 0, int(val*width), height(), QBrush(Qt::blue));
                p->fillRect(int(val*width), 0, width, height(),
                            QBrush(isSelected() ? cg.highlight() : cg.base()));

                QPen pen(isSelected() ? cg.highlightedText() : cg.foreground());
                p->setPen(pen);
                p->drawText(0, 0, width, height(), Qt::AlignRight, text(column));
            }
            else
            {
                toTreeWidgetItem::paintCell(p, cg, column, width, alignment);
            }
#endif
        }
        bool operator<(const toTreeWidgetItem &other)
        {
#if 0                           // todo tree
            int col = treeWidget()->sortColumn();
            if (col == 2 || col == 3 || col == 4)
            {
                toProfilerSource::listItem *item =
                    dynamic_cast<toProfilerSource::listItem>(&other);
                if (!i)
                    return toTreeWidgetItem::operator<(other);
                else
                {
                    double val_in = allText(col).toDouble();
                    double val_out = item->allText(col).toDouble();
                    return val_in < val_out;
                }
            }
            else
#endif
                return toTreeWidgetItem::operator<(other);
        }