bool QScrollView::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: resizeContents((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 1: scrollBy((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 2: setContentsPos((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 3: ensureVisible((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 4: ensureVisible((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3),(int)static_QUType_int.get(_o+4)); break;
    case 5: center((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 6: center((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(float)(*((float*)static_QUType_ptr.get(_o+3))),(float)(*((float*)static_QUType_ptr.get(_o+4)))); break;
    case 7: updateScrollBars(); break;
    case 8: setEnabled((bool)static_QUType_bool.get(_o+1)); break;
    case 9: hslide((int)static_QUType_int.get(_o+1)); break;
    case 10: vslide((int)static_QUType_int.get(_o+1)); break;
    case 11: hbarIsPressed(); break;
    case 12: hbarIsReleased(); break;
    case 13: vbarIsPressed(); break;
    case 14: vbarIsReleased(); break;
    case 15: doDragAutoScroll(); break;
    case 16: startDragAutoScroll(); break;
    case 17: stopDragAutoScroll(); break;
    default:
	return QFrame::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemple #2
0
/*!
Call this if properties change dynamically that would require resizing
the scrollbar.
*/
void QwViewport::resizeScrollBars()
{
	int w=width();
	int h=height();

	if (viewedWidget()) {
		int portw,porth;

		bool needh = w<viewedWidget()->width();
		bool needv = h<viewedWidget()->height();

		if (needh && h-scrollBarWidth()<viewedWidget()->height())
			needv=true;
		if (needv && w-scrollBarWidth()<viewedWidget()->width())
			needh=true;

		if (needh) {
			hbar.show();
			porth=h-scrollBarWidth();
		} else {
			hslide(0);
			hbar.hide();
			porth=h;
		}

		if (needv) {
			vbar.show();
			portw=w-scrollBarWidth();
		} else {
			vslide(0);
			vbar.hide();
			portw=w;
		}

		if (needv) {
			vbar.setRange(0,viewedWidget()->height()-porth);
			vbar.setSteps(1,porth);
		}
		if (needh) {
			hbar.setRange(0,viewedWidget()->width()-portw);
			hbar.setSteps(1,portw);
		}

		int top,bottom;

		if (needh) {
			int right=((needv && emptyCorner())
					 || alwaysEmptyCorner())
				? w-scrollBarWidth() : w;
			if (scrollBarOnTop()) {
				hbar.setGeometry(0,h-scrollBarWidth(),right,scrollBarWidth());
				top=scrollBarWidth();
				bottom=h;
			} else {
				hbar.setGeometry(0,h-scrollBarWidth(),right,scrollBarWidth());
				top=0;
				bottom=h-scrollBarWidth();
			}
		} else {
			top=0;
			bottom=h;
		}
		if (needv) {
			if (scrollBarOnLeft()) {
				vbar.setGeometry(0,top,scrollBarWidth(),bottom);
				porthole.setGeometry(scrollBarWidth(),top,w-scrollBarWidth(),bottom);
			} else {
				vbar.setGeometry(w-scrollBarWidth(),top,scrollBarWidth(),bottom);
				porthole.setGeometry(0,top,w-scrollBarWidth(),bottom);
			}
		} else {
			porthole.setGeometry(0,top,w,bottom);
		}
	} else {
		hbar.hide();
		vbar.hide();
		porthole.setGeometry(0,0,w,h);
	}
}