void KitOptionsPageWidget::cloneKit()
{
    Kit *current = currentKit();
    if (!current)
        return;

    Kit *k = m_model->markForAddition(current);
    QModelIndex newIdx = m_model->indexOf(k);
    m_kitsView->scrollTo(newIdx);
    m_selectionModel->select(newIdx,
                             QItemSelectionModel::Clear
                             | QItemSelectionModel::SelectCurrent
                             | QItemSelectionModel::Rows);
}
Exemple #2
0
int TreeView::scrollTo(lua_State * L) // ( const QModelIndex & index, ScrollHint hint = EnsureVisible )
{
    QTreeView* obj = QtObject<QTreeView>::check( L, 1);
    QModelIndex* index = QtValue<QModelIndex>::check( L, 2 );
	QAbstractItemView::ScrollHint f;
	int fInt = Util::toInt( L, 3 );
	if( (fInt >= 0 && fInt <= 3) )
	{
		f = (QAbstractItemView::ScrollHint) fInt;
		obj->scrollTo( *index, f );
	}
	else
		Lua::Util::error( L, "expecting a valid QAbstractItemView::ScrollHint" );
	return 0;
}
void KitOptionsPageWidget::kitSelectionChanged()
{
    QModelIndex current = currentIndex();
    QWidget *newWidget = m_model->widget(current);
    if (newWidget == m_currentWidget)
        return;

    if (m_currentWidget)
        m_currentWidget->setVisible(false);

    m_currentWidget = newWidget;

    if (m_currentWidget) {
        m_currentWidget->setVisible(true);
        m_kitsView->scrollTo(current);
    }
    updateState();
}