18 #include <QApplication>
19 #include <QMainWindow>
20 #include <QMouseEvent>
24 #include <QGridLayout>
26 #include <QDesktopWidget>
51 : QGraphicsView( parent )
52 , mCurrentTool( Select )
53 , mPreviousTool( Select )
54 , mRubberBandItem( 0 )
55 , mRubberBandLineItem( 0 )
56 , mMoveContentItem( 0 )
57 , mMarqueeSelect( false )
58 , mMarqueeZoom( false )
60 , mPaintingEnabled( true )
61 , mHorizontalRuler( 0 )
63 , mToolPanning( false )
64 , mMousePanning( false )
65 , mKeyPanning( false )
66 , mMovingItemContent( false )
72 setResizeAnchor( QGraphicsView::AnchorViewCenter );
73 setMouseTracking(
true );
74 viewport()->setMouseTracking(
true );
75 setFrameShape( QFrame::NoFrame );
78 viewport()->setGraphicsEffect( mPreviewEffect );
96 viewport()->setCursor( defaultCursorForTool(
Pan ) );
104 viewport()->setCursor( defaultCursorForTool(
Zoom ) );
123 viewport()->setCursor( defaultCursorForTool( mCurrentTool ) );
130 viewport()->setCursor( Qt::ArrowCursor );
142 if ( mRubberBandItem || mRubberBandLineItem || mKeyPanning || mMousePanning || mToolPanning || mMovingItemContent )
154 QPointF scenePoint = mapToScene( e->pos() );
156 mMousePressStartPos = e->pos();
158 if ( e->button() == Qt::RightButton )
164 else if ( e->button() == Qt::MidButton )
167 mMousePanning =
true;
168 mMouseLastXY = e->pos();
174 viewport()->setCursor( Qt::ClosedHandCursor );
178 switch ( mCurrentTool )
184 if (
composition()->selectionHandles()->isVisible() )
200 if ( e->modifiers() & Qt::ControlModifier )
205 if ( selectedItems.size() > 0 )
207 previousSelectedItem = selectedItems.at( 0 );
211 if ( previousSelectedItem )
232 startMarqueeSelect( scenePoint );
236 if (( !selectedItem->
selected() ) &&
237 !( e->modifiers() & Qt::ShiftModifier ) )
242 if (( e->modifiers() & Qt::ShiftModifier ) && ( selectedItem->
selected() ) )
249 if ( selectedItems.size() > 0 )
265 if ( !( e->modifiers() & Qt::ShiftModifier ) )
268 startMarqueeZoom( scenePoint );
273 double scaleFactor = 2;
275 QRect viewportRect( 0, 0, viewport()->width(), viewport()->height() );
279 QPointF scenePoint = mapToScene( e->pos() );
281 visibleRect.
scale( scaleFactor, scenePoint.x(), scenePoint.y() );
282 QRectF boundsRect = visibleRect.
toRectF();
285 fitInView( boundsRect, Qt::KeepAspectRatio );
294 mMouseLastXY = e->pos();
295 viewport()->setCursor( Qt::ClosedHandCursor );
302 QList<QGraphicsItem *> itemsAtCursorPos = items( e->pos() );
303 if ( itemsAtCursorPos.size() == 0 )
311 QList<QGraphicsItem*>::iterator itemIter = itemsAtCursorPos.begin();
312 for ( ; itemIter != itemsAtCursorPos.end(); ++itemIter )
318 mMoveContentStartPos = scenePoint;
319 mMoveContentItem = item;
320 mMovingItemContent =
true;
332 mRubberBandStartPos = QPointF( snappedScenePoint.x(), snappedScenePoint.y() );
333 mRubberBandLineItem =
new QGraphicsLineItem( snappedScenePoint.x(), snappedScenePoint.y(), snappedScenePoint.x(), snappedScenePoint.y() );
334 mRubberBandLineItem->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) );
335 mRubberBandLineItem->setZValue( 1000 );
336 scene()->addItem( mRubberBandLineItem );
354 mRubberBandItem =
new QGraphicsRectItem( 0, 0, 0, 0 );
355 mRubberBandItem->setBrush( Qt::NoBrush );
356 mRubberBandItem->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) );
357 mRubberBandStartPos = QPointF( snappedScenePoint.x(), snappedScenePoint.y() );
358 t.translate( snappedScenePoint.x(), snappedScenePoint.y() );
359 mRubberBandItem->setTransform( t );
360 mRubberBandItem->setZValue( 1000 );
361 scene()->addItem( mRubberBandItem );
370 newScaleBar->
setSceneRect( QRectF( snappedScenePoint.x(), snappedScenePoint.y(), 20, 20 ) );
373 if ( mapItemList.size() > 0 )
393 QCursor QgsComposerView::defaultCursorForTool( Tool currentTool )
395 switch ( currentTool )
398 return Qt::ArrowCursor;
402 QPixmap myZoomQPixmap = QPixmap((
const char ** )(
zoom_in ) );
403 return QCursor( myZoomQPixmap, 7, 7 );
407 return Qt::OpenHandCursor;
410 return Qt::ArrowCursor;
426 return QCursor( myCrosshairQPixmap, 8, 8 );
429 return Qt::ArrowCursor;
432 void QgsComposerView::addShape( Tool currentTool )
441 if ( !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
466 if ( mHorizontalRuler )
470 if ( mVerticalRuler )
476 void QgsComposerView::removeRubberBand()
478 if ( mRubberBandItem )
480 scene()->removeItem( mRubberBandItem );
481 delete mRubberBandItem;
486 void QgsComposerView::startMarqueeSelect( QPointF & scenePoint )
488 mMarqueeSelect =
true;
491 mRubberBandItem =
new QGraphicsRectItem( 0, 0, 0, 0 );
492 mRubberBandItem->setBrush( QBrush( QColor( 224, 178, 76, 63 ) ) );
493 mRubberBandItem->setPen( QPen( QBrush( QColor( 254, 58, 29, 100 ) ), 0, Qt::DotLine ) );
494 mRubberBandStartPos = QPointF( scenePoint.x(), scenePoint.y() );
495 t.translate( scenePoint.x(), scenePoint.y() );
496 mRubberBandItem->setTransform( t );
497 mRubberBandItem->setZValue( 1000 );
498 scene()->addItem( mRubberBandItem );
502 void QgsComposerView::endMarqueeSelect( QMouseEvent* e )
504 mMarqueeSelect =
false;
506 bool subtractingSelection =
false;
507 if ( e->modifiers() & Qt::ShiftModifier )
511 else if ( e->modifiers() & Qt::ControlModifier )
514 subtractingSelection =
true;
522 if ( !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
529 QRectF boundsRect = QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(),
530 mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
533 Qt::ItemSelectionMode selectionMode = Qt::IntersectsItemShape;
534 if ( e->modifiers() & Qt::AltModifier )
537 selectionMode = Qt::ContainsItemShape;
541 QList<QGraphicsItem *> itemList =
composition()->items( boundsRect, selectionMode );
542 QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
543 for ( ; itemIt != itemList.end(); ++itemIt )
547 if ( mypItem && !paperItem )
551 if ( subtractingSelection )
566 if ( selectedItemList.size() > 0 )
572 void QgsComposerView::startMarqueeZoom( QPointF & scenePoint )
577 mRubberBandItem =
new QGraphicsRectItem( 0, 0, 0, 0 );
578 mRubberBandItem->setBrush( QBrush( QColor( 70, 50, 255, 25 ) ) );
579 mRubberBandItem->setPen( QPen( QColor( 70, 50, 255, 100 ) ) );
580 mRubberBandStartPos = QPointF( scenePoint.x(), scenePoint.y() );
581 t.translate( scenePoint.x(), scenePoint.y() );
582 mRubberBandItem->setTransform( t );
583 mRubberBandItem->setZValue( 1000 );
584 scene()->addItem( mRubberBandItem );
588 void QgsComposerView::endMarqueeZoom( QMouseEvent* e )
590 mMarqueeZoom =
false;
594 if ( !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
597 double scaleFactor = 0.5;
599 QRect viewportRect( 0, 0, viewport()->width(), viewport()->height() );
603 QPointF scenePoint = mapToScene( e->pos() );
605 visibleRect.
scale( scaleFactor, scenePoint.x(), scenePoint.y() );
606 boundsRect = visibleRect.
toRectF();
612 boundsRect = QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(),
613 mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
618 fitInView( boundsRect, Qt::KeepAspectRatio );
636 if ( e->button() != Qt::LeftButton &&
643 QPoint mousePressStopPoint = e->pos();
644 int diffX = mousePressStopPoint.x() - mMousePressStartPos.x();
645 int diffY = mousePressStopPoint.y() - mMousePressStartPos.y();
648 bool clickOnly =
false;
649 if ( qAbs( diffX ) < 2 && qAbs( diffY ) < 2 )
654 QPointF scenePoint = mapToScene( e->pos() );
656 if ( mMousePanning || mToolPanning )
658 mMousePanning =
false;
659 mToolPanning =
false;
661 if ( clickOnly && e->button() == Qt::MidButton )
666 QRect viewportRect( 0, 0, viewport()->width(), viewport()->height() );
668 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
669 QRectF boundsRect = visibleRect.
toRectF();
672 fitInView( boundsRect, Qt::KeepAspectRatio );
676 if ( mCurrentTool !=
Pan )
684 viewport()->setCursor( defaultCursorForTool( mCurrentTool ) );
688 if ( e->button() != Qt::LeftButton )
693 if ( mMarqueeSelect )
695 endMarqueeSelect( e );
699 switch ( mCurrentTool )
718 if ( mMoveContentItem )
727 double moveX = scenePoint.x() - mMoveContentStartPos.x();
728 double moveY = scenePoint.y() - mMoveContentStartPos.y();
733 mMoveContentItem = 0;
734 mMovingItemContent =
false;
741 scene()->removeItem( mRubberBandLineItem );
742 delete mRubberBandLineItem;
743 mRubberBandLineItem = 0;
755 scene()->removeItem( mRubberBandLineItem );
756 delete mRubberBandLineItem;
757 mRubberBandLineItem = 0;
766 addShape( mCurrentTool );
770 if ( !
composition() || !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
777 QgsComposerMap* composerMap =
new QgsComposerMap(
composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
791 if ( !
composition() || !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
799 newPicture->
setSceneRect( QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() ) );
825 double labelWidth = qMax( mRubberBandItem->rect().width(), newLabelItem->rect().width() );
826 double labelHeight = qMax( mRubberBandItem->rect().height(), newLabelItem->rect().height() );
827 newLabelItem->
setSceneRect( QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), labelWidth, labelHeight ) );
851 if ( mapItemList.size() > 0 )
855 newLegend->
setSceneRect( QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() ) );
879 if ( mapItemList.size() > 0 )
883 newTable->
setSceneRect( QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() ) );
907 if ( mapItemList.size() > 0 )
915 mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(),
916 mRubberBandItem->rect().height() );
931 if ( !
composition() || !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
943 mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(),
944 mRubberBandItem->rect().height() );
968 bool shiftModifier =
false;
969 bool altModifier =
false;
970 if ( e->modifiers() & Qt::ShiftModifier )
973 shiftModifier =
true;
975 if ( e->modifiers() & Qt::AltModifier )
981 mMouseCurrentXY = e->pos();
986 if ( mHorizontalRuler )
990 if ( mVerticalRuler )
995 if ( mToolPanning || mMousePanning || mKeyPanning )
998 horizontalScrollBar()->setValue( horizontalScrollBar()->value() - ( e->x() - mMouseLastXY.x() ) );
999 verticalScrollBar()->setValue( verticalScrollBar()->value() - ( e->y() - mMouseLastXY.y() ) );
1000 mMouseLastXY = e->pos();
1003 else if ( e->buttons() == Qt::NoButton )
1005 if ( mCurrentTool ==
Select )
1012 QPointF scenePoint = mapToScene( e->pos() );
1014 if ( mMarqueeSelect || mMarqueeZoom )
1016 updateRubberBandRect( scenePoint );
1020 switch ( mCurrentTool )
1028 updateRubberBandLine( scenePoint, shiftModifier );
1044 updateRubberBandRect( scenePoint, shiftModifier, altModifier );
1054 composerMap->
setOffset( scenePoint.x() - mMoveContentStartPos.x(), scenePoint.y() - mMoveContentStartPos.y() );
1055 composerMap->update();
1065 void QgsComposerView::updateRubberBandRect( QPointF & pos,
const bool constrainSquare,
const bool fromCenter )
1067 if ( !mRubberBandItem )
1077 double dx = pos.x() - mRubberBandStartPos.x();
1078 double dy = pos.y() - mRubberBandStartPos.y();
1080 if ( constrainSquare )
1082 if ( fabs( dx ) > fabs( dy ) )
1089 height = fabs( dy );
1093 x = mRubberBandStartPos.x() - (( dx < 0 ) ? width : 0 );
1094 y = mRubberBandStartPos.y() - (( dy < 0 ) ? height : 0 );
1106 x = mRubberBandStartPos.x();
1117 y = mRubberBandStartPos.y();
1124 x = mRubberBandStartPos.x() - width;
1125 y = mRubberBandStartPos.y() - height;
1130 mRubberBandItem->setRect( 0, 0, width, height );
1132 t.translate( x, y );
1133 mRubberBandItem->setTransform( t );
1136 void QgsComposerView::updateRubberBandLine(
const QPointF &pos,
const bool constrainAngles )
1138 if ( !mRubberBandLineItem )
1146 QLineF newLine = QLineF( mRubberBandStartPos, snappedScenePoint );
1148 if ( constrainAngles )
1152 newLine.setAngle( angle );
1155 mRubberBandLineItem->setLine( newLine );
1171 QList<QgsComposerItem*>::iterator itemIt = composerItemList.begin();
1174 QDomElement documentElement = doc.createElement(
"ComposerItemClipboard" );
1175 for ( ; itemIt != composerItemList.end(); ++itemIt )
1181 QSet<QgsComposerItem*> groupedItems = itemGroup->
items();
1182 QSet<QgsComposerItem*>::iterator it = groupedItems.begin();
1183 for ( ; it != groupedItems.end(); ++it )
1185 ( *it )->writeXML( documentElement, doc );
1188 ( *itemIt )->writeXML( documentElement, doc );
1194 doc.appendChild( documentElement );
1200 QDomNodeList composerItemsNodes = doc.elementsByTagName(
"ComposerItem" );
1201 for (
int i = 0; i < composerItemsNodes.count(); ++i )
1203 QDomNode composerItemNode = composerItemsNodes.at( i );
1204 if ( composerItemNode.isElement() )
1206 composerItemNode.toElement().removeAttribute(
"uuid" );
1211 QMimeData *mimeData =
new QMimeData;
1212 mimeData->setData(
"text/xml", doc.toByteArray() );
1213 QClipboard *clipboard = QApplication::clipboard();
1214 clipboard->setMimeData( mimeData );
1225 QClipboard *clipboard = QApplication::clipboard();
1226 if ( doc.setContent( clipboard->mimeData()->data(
"text/xml" ) ) )
1228 QDomElement docElem = doc.documentElement();
1229 if ( docElem.tagName() ==
"ComposerItemClipboard" )
1237 pt = mapToScene( mapFromGlobal( QCursor::pos() ) );
1242 pt = mapToScene( viewport()->rect().center() );
1262 QList<QgsComposerItem*>::iterator itemIt = composerItemList.begin();
1265 for ( ; itemIt != composerItemList.end(); ++itemIt )
1282 QList<QGraphicsItem *> itemList =
composition()->items();
1283 QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
1284 for ( ; itemIt != itemList.end(); ++itemIt )
1288 if ( mypItem && !paperItem )
1322 QList<QGraphicsItem *> itemList =
composition()->items();
1323 QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
1324 for ( ; itemIt != itemList.end(); ++itemIt )
1328 if ( mypItem && !paperItem )
1352 if ( mKeyPanning || mMousePanning || mToolPanning || mMovingItemContent ||
1361 if ( e->isAutoRepeat() )
1367 if ( !( e->modifiers() & Qt::ControlModifier ) && !mMarqueeZoom )
1373 else if ( !( e->modifiers() & Qt::ControlModifier ) && mMarqueeZoom )
1383 QPixmap myZoomQPixmap = QPixmap((
const char ** )( e->modifiers() & Qt::ShiftModifier ?
zoom_out :
zoom_in ) );
1384 QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
1385 viewport()->setCursor( zoomCursor );
1396 if ( e->key() == Qt::Key_Space && ! e->isAutoRepeat() )
1398 if ( !( e->modifiers() & Qt::ControlModifier ) )
1402 mMouseLastXY = mMouseCurrentXY;
1408 viewport()->setCursor( Qt::ClosedHandCursor );
1415 mPreviousTool = mCurrentTool;
1418 QPixmap myZoomQPixmap = QPixmap((
const char ** )( e->modifiers() & Qt::ShiftModifier ?
zoom_out :
zoom_in ) );
1419 QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
1420 viewport()->setCursor( zoomCursor );
1428 if ( ! e->isAutoRepeat() )
1430 QPixmap myZoomQPixmap = QPixmap((
const char ** )( e->modifiers() & Qt::ShiftModifier ?
zoom_out :
zoom_in ) );
1431 QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
1432 viewport()->setCursor( zoomCursor );
1438 QList<QgsComposerItem*>::iterator itemIt = composerItemList.begin();
1441 double increment = 1.0;
1442 if ( e->modifiers() & Qt::ShiftModifier )
1447 else if ( e->modifiers() & Qt::AltModifier )
1450 double viewScale = transform().m11();
1451 if ( viewScale > 0 )
1453 increment = 1 / viewScale;
1457 if ( e->key() == Qt::Key_Left )
1459 for ( ; itemIt != composerItemList.end(); ++itemIt )
1462 ( *itemIt )->move( -1 * increment, 0.0 );
1463 ( *itemIt )->endCommand();
1466 else if ( e->key() == Qt::Key_Right )
1468 for ( ; itemIt != composerItemList.end(); ++itemIt )
1471 ( *itemIt )->move( increment, 0.0 );
1472 ( *itemIt )->endCommand();
1475 else if ( e->key() == Qt::Key_Down )
1477 for ( ; itemIt != composerItemList.end(); ++itemIt )
1480 ( *itemIt )->move( 0.0, increment );
1481 ( *itemIt )->endCommand();
1484 else if ( e->key() == Qt::Key_Up )
1486 for ( ; itemIt != composerItemList.end(); ++itemIt )
1489 ( *itemIt )->move( 0.0, -1 * increment );
1490 ( *itemIt )->endCommand();
1497 if ( e->key() == Qt::Key_Space && !e->isAutoRepeat() && mKeyPanning )
1500 mKeyPanning =
false;
1503 if ( mCurrentTool !=
Pan )
1511 viewport()->setCursor( defaultCursorForTool( mCurrentTool ) );
1533 if ( ! e->isAutoRepeat() )
1535 QPixmap myZoomQPixmap = QPixmap((
const char ** )( e->modifiers() & Qt::ShiftModifier ?
zoom_out :
zoom_in ) );
1536 QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
1537 viewport()->setCursor( zoomCursor );
1545 if ( mRubberBandItem || mRubberBandLineItem )
1551 if (
composition()->selectionHandles()->isDragging() ||
composition()->selectionHandles()->isResizing() )
1561 QPointF scenePoint = mapToScene( event->pos() );
1566 if ( theItem->isSelected() )
1577 double zoomFactor = settings.value(
"/qgis/zoom_factor", 2.0 ).toDouble();
1578 if ( event->modifiers() & Qt::ControlModifier )
1581 zoomFactor = 1.0 + ( zoomFactor - 1.0 ) / 20.0;
1583 zoomFactor =
event->delta() > 0 ? zoomFactor : 1 / zoomFactor;
1585 QPointF itemPoint = theItem->mapFromScene( scenePoint );
1587 theItem->zoomContent( zoomFactor, itemPoint, zoomMode );
1588 theItem->endCommand();
1599 void QgsComposerView::wheelZoom( QWheelEvent * event )
1602 QSettings mySettings;
1603 int wheelAction = mySettings.value(
"/qgis/wheel_action", 2 ).toInt();
1604 double zoomFactor = mySettings.value(
"/qgis/zoom_factor", 2 ).toDouble();
1611 if ( event->modifiers() & Qt::ControlModifier )
1614 zoomFactor = 1.0 + ( zoomFactor - 1.0 ) / 10.0;
1618 bool zoomIn =
event->delta() > 0;
1619 double scaleFactor = ( zoomIn ? 1 / zoomFactor : zoomFactor );
1622 QRect viewportRect( 0, 0, viewport()->width(), viewport()->height() );
1626 QPointF scenePoint = mapToScene( event->pos() );
1633 centerOn( scenePoint.x(), scenePoint.y() );
1640 QgsPoint newCenter( scenePoint.x() + (( oldCenter.x() - scenePoint.x() ) * scaleFactor ),
1641 scenePoint.y() + (( oldCenter.y() - scenePoint.y() ) * scaleFactor ) );
1642 centerOn( newCenter.x(), newCenter.y() );
1653 scale( zoomFactor, zoomFactor );
1657 scale( 1 / zoomFactor, 1 / zoomFactor );
1665 QList<QGraphicsItem *> itemList =
composition()->items();
1666 QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
1667 for ( ; itemIt != itemList.end(); ++itemIt )
1679 double dpi = QgsApplication::desktop()->logicalDpiX();
1681 if (( dpi < 60 ) || ( dpi > 250 ) )
1685 double scale = zoomLevel * dpi / 25.4;
1686 setTransform( QTransform::fromScale( scale, scale ) );
1695 if ( !mPreviewEffect )
1700 mPreviewEffect->setEnabled( enabled );
1705 if ( !mPreviewEffect )
1710 mPreviewEffect->
setMode( mode );
1715 if ( mPaintingEnabled )
1754 if ( mHorizontalRuler )
1758 if ( mVerticalRuler )
1810 QList<QgsComposerItem*>::iterator itemIter = selectionList.begin();
1811 for ( ; itemIter != selectionList.end(); ++itemIter )
1823 QMainWindow* composerObject = 0;
1824 QObject* currentObject = parent();
1825 if ( !currentObject )
1827 return qobject_cast<QMainWindow *>( currentObject );
1832 composerObject = qobject_cast<QMainWindow*>( currentObject );
1833 if ( composerObject || currentObject->parent() == 0 )
1835 return composerObject;
1837 currentObject = currentObject->parent();