Example #1
0
QSize QTreeWidgetItemProto::sizeHint(int column)	        const
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    return item->sizeHint(column);
  return QSize();
}
Example #2
0
void NTrashTree::calculateHeight()
{
    int h = 0;

    int topLevelCount = topLevelItemCount();

    for(int i = 0;i < topLevelCount;i++)    {
        QTreeWidgetItem * item = topLevelItem(i);
        h += calculateHeightRec(item);
        h += item->sizeHint(0).height() + 5;
    }

    if(h != 0)    {
        setMinimumHeight(h+5);
        setMaximumHeight(h+5);
    }
    this->setMaximumWidth(this->sizeHint().width());
}
Example #3
0
void AlbumList::resizeLastHint()
{
    int counts = childCount();
    QTreeWidgetItem* item = child(counts-1);
    if( !item ) return;

//    qDebug() << counts;
    // 当前行数小于8行,则需要增加高度
    if( 8 - counts > 1 )
    {
        item->setSizeHint( 0, QSize(1, 16*(8-counts)) );
    }
    else
    {
        int h = item->sizeHint(0).height();
        if( h > 16 )
            item->setSizeHint( 0, QSize(1, h/(counts-8)) );
    }
}
Example #4
0
void NTrashTree::calculateHeight()
{
    int h = 0;

    int topLevelCount = topLevelItemCount();

    for(int i = 0;i < topLevelCount;i++)
    {
        QTreeWidgetItem * item = topLevelItem(i);
        h += calculateHeightRec(item);
        h += item->sizeHint(0).height() + 5;
    }

    if(h != 0)
    {
//        h += header()->sizeHint().height();

        setMinimumHeight(h);
        setMaximumHeight(h);
    }
}