myForegroundItem( 0 ),
myGridItem( 0 ),
myIsTransforming( false ),
+ myUnlimitedPanning( false ),
myHighlightedObject( 0 ),
myHighlightX( 0 ),
myHighlightY( 0 ),
QPainter::SmoothPixmapTransform |
QPainter::HighQualityAntialiasing );
+ myHBarPolicy = horizontalScrollBarPolicy();
+ myVBarPolicy = verticalScrollBarPolicy();
+
connect( myScene, SIGNAL( gsKeyEvent( QKeyEvent* ) ),
this, SLOT( onKeyEvent( QKeyEvent* ) ) );
connect( myScene, SIGNAL( gsMouseEvent( QGraphicsSceneMouseEvent* ) ),
myViewLabel->setAcceptMoveEvents( false );
if( QScrollBar* aHBar = horizontalScrollBar() )
+ {
+ if( isUnlimitedPanning() )
+ {
+ int aNewValue = aHBar->value() - theDX;
+ if( aNewValue < aHBar->minimum() )
+ aHBar->setMinimum( aNewValue );
+ if( aNewValue > aHBar->maximum() )
+ aHBar->setMaximum( aNewValue );
+ }
aHBar->setValue( aHBar->value() - theDX );
+ }
if( QScrollBar* aVBar = verticalScrollBar() )
+ {
+ if( isUnlimitedPanning() )
+ {
+ int aNewValue = aVBar->value() + theDY;
+ if( aNewValue < aVBar->minimum() )
+ aVBar->setMinimum( aNewValue );
+ if( aNewValue > aVBar->maximum() )
+ aVBar->setMaximum( aNewValue );
+ }
aVBar->setValue( aVBar->value() + theDY );
+ }
if( myViewLabel )
myViewLabel->setAcceptMoveEvents( true );
myZoomCoeff = theZoomCoeff;
}
+//================================================================
+// Function : setUnlimitedPanning
+// Purpose :
+//================================================================
+void GraphicsView_ViewPort::setUnlimitedPanning( const bool& theValue )
+{
+ myUnlimitedPanning = theValue;
+
+ if( myUnlimitedPanning )
+ {
+ myHBarPolicy = horizontalScrollBarPolicy();
+ myVBarPolicy = verticalScrollBarPolicy();
+
+ setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
+ setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
+ }
+ else
+ {
+ setHorizontalScrollBarPolicy( myHBarPolicy );
+ setVerticalScrollBarPolicy( myVBarPolicy );
+ }
+}
+
//================================================================
// Function : currentBlock
// Purpose :
int zoomCoeff() const { return myZoomCoeff; }
void setZoomCoeff( const int& theZoomCoeff );
+ bool isUnlimitedPanning() const { return myUnlimitedPanning; }
+ void setUnlimitedPanning( const bool& theValue );
+
// block status
BlockStatus currentBlock();
bool myIsTransforming;
QTransform myCurrentTransform;
+ bool myUnlimitedPanning;
+ Qt::ScrollBarPolicy myHBarPolicy;
+ Qt::ScrollBarPolicy myVBarPolicy;
+
// highlighting
GraphicsView_Object* myHighlightedObject;
double myHighlightX;