コード例 #1
0
ファイル: QtlHeaderView.cpp プロジェクト: Wushaowei001/NAF
int HeaderView::sizeHint(lua_State * L) // const : QSize 
{
    QHeaderView* obj = QtObject<QHeaderView>::check( L, 1);
    QSizeF* res = QtValue<QSizeF>::create( L );
	*res = obj->sizeHint();
	return 1;
}
コード例 #2
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tAbstractChannelTable::RecalculateNumberOfRowsAndFocusRow(const int listSize)
{
    TRACE_FUNCTION;
    if (m_RowHeight)
    {
        QHeaderView* pHorizontalHeader = horizontalHeader();
        int headerHeight = pHorizontalHeader->sizeHint().height();

        m_MaximumNumberOfRows = (m_TotalVisibleHeight - headerHeight) / m_RowHeight;
    }
    else
    {
        m_MaximumNumberOfRows = 1;
    }
    m_NumberOfRows = m_MaximumNumberOfRows;

    // Limit the number of rows to available data
    if (m_NumberOfRows > listSize)
    {
        m_NumberOfRows = listSize;
    }

    // Want the focus row to be just before the middle of the table
    if (m_NumberOfRows < 3)
    {
        //do we know our height yet?
        if (m_RowHeight && m_NumberOfRows == 2) // if only 1 row, focus must be 0
        {
            //yes
            m_FocusRow = 1;
        }
        else
        {
            //no, so we really don't know our focus row yet
            m_FocusRow = 0;
        }
    }
    else
    {
        m_FocusRow = (m_NumberOfRows - 1) / 2;
    }

    // Size the table
    setRowCount(m_NumberOfRows);
    emit NewFocusRow(GetFocusRow());
}