예제 #1
0
int KompareSplitter::pageSize()
{
	if(widget(0)) {
		KompareListView *view = listView(0);
		return view->visibleHeight() - view->style()->pixelMetric( QStyle::PM_ScrollBarExtent );
	}
	return 1;
}
예제 #2
0
void KompareSplitter::slotConfigChanged()
{
	const int end = count();
	for ( int i = 0; i < end; ++i ) {
		KompareListView *view = listView(i);
		view->setFont( m_settings->m_font );
		view->update();
	}
}
예제 #3
0
bool KompareSplitter::needHScrollBar()
{
	const int end = count();
	for ( int i = 0; i < end; ++i ) {
		KompareListView *view = listView(i);
		if ( view->contentsWidth() > view->visibleWidth() )
			return true;
	}
	return false;
}
예제 #4
0
int KompareSplitter::pageSize()
{
	QSplitterLayoutStruct *curr;
	for ( curr = d->list.first(); curr; curr = d->list.next() )
	{
		if ( !curr->isHandle )
		{
			KompareListView *view = ((KompareListViewFrame*) curr->wid)->view();
			return view->visibleHeight() - QStyle::PM_ScrollBarExtent;
		}
	}
	return 1;
}
예제 #5
0
int KompareSplitter::maxHScrollId()
{
	int max = 0;
	int mHSId;
	const int end = count();
	for ( int i = 0; i < end; ++i ) {
		KompareListView *view = listView(i);
		mHSId = view->contentsWidth() - view->visibleWidth();
		if ( mHSId > max )
			max = mHSId;
	}
	return max;
}
예제 #6
0
bool KompareSplitter::needHScrollBar()
{
	QSplitterLayoutStruct *curr;
	for ( curr = d->list.first(); curr; curr = d->list.next() )
	{
		if( !curr->isHandle )
		{
			KompareListView *view = ((KompareListViewFrame*) curr->wid)->view();
			if ( view->contentsWidth() > view->visibleWidth() )
				return true;
		}
	}
	return false;
}
예제 #7
0
int KompareSplitter::minVScrollId()
{

	QSplitterLayoutStruct *curr;
	int min = -1;
	int mSId;
	for ( curr = d->list.first(); curr; curr = d->list.next() )
	{
		if(!curr->isHandle) {
			KompareListView* view = ((KompareListViewFrame*)curr->wid)->view();
			mSId = view->minScrollId();
			if (mSId < min || min == -1) min = mSId;
		}
	}
	return ( min == -1 ) ? 0 : min;
}
예제 #8
0
int KompareSplitter::maxHScrollId()
{
	QSplitterLayoutStruct *curr;
	int max = 0;
	int mHSId;
	for ( curr = d->list.first(); curr; curr = d->list.next() )
	{
		if( !curr->isHandle )
		{
			KompareListView *view = ((KompareListViewFrame*) curr->wid)->view();
			mHSId = view->contentsWidth() - view->visibleWidth();
			if ( mHSId > max )
				max = mHSId;
		}
	}
	return max;
}
예제 #9
0
void KompareSplitter::slotUpdateScrollBars()
{
	const int end = count();
	for ( int i = 0; i < end; ++i ) {
		KompareListView* lv = listView(i);
		int minHScroll = minHScrollId();
		if (lv->contentsX() < minHScroll) {
			lv->setXOffset(minHScroll);
		}
	}

	int m_scrollDistance = m_settings->m_scrollNoOfLines * lineHeight();
	int m_pageSize = pageSize();

	if( needVScrollBar() )
	{
		m_vScroll->show();

		m_vScroll->blockSignals( true );
		m_vScroll->setRange( minVScrollId(),
		                     maxVScrollId() );
		m_vScroll->setValue( scrollId() );
		m_vScroll->setSingleStep( m_scrollDistance );
		m_vScroll->setPageStep( m_pageSize );
		m_vScroll->blockSignals( false );
	}
	else
	{
		m_vScroll->hide();
	}

	if( needHScrollBar() )
	{
		m_hScroll->show();
		m_hScroll->blockSignals( true );
		m_hScroll->setRange( minHScrollId(), maxHScrollId() );
		m_hScroll->setValue( maxContentsX() );
		m_hScroll->setSingleStep( 10 );
		m_hScroll->setPageStep( minVisibleWidth() - 10 );
		m_hScroll->blockSignals( false );
	}
	else
	{
		m_hScroll->hide();
	}
}