mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
More cleanups
This commit is contained in:
parent
c9bcd60a89
commit
a5f15d88b1
@ -70,23 +70,9 @@ class QgsComposerView: QGraphicsView
|
||||
void wheelEvent( QWheelEvent* event );
|
||||
|
||||
|
||||
public slots:
|
||||
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
|
||||
void sendItemAddedSignal( QgsComposerItem* item );
|
||||
|
||||
signals:
|
||||
/**Is emitted when selected item changed. If 0, no item is selected*/
|
||||
void selectedItemChanged( QgsComposerItem* selected );
|
||||
/**Ist emittted when new composer label has been added to the view*/
|
||||
void composerLabelAdded( QgsComposerLabel* label );
|
||||
/**Is emitted when new composer map has been added to the view*/
|
||||
void composerMapAdded( QgsComposerMap* map );
|
||||
/**Is emitted when new composer scale bar has been added*/
|
||||
void composerScaleBarAdded( QgsComposerScaleBar* scalebar );
|
||||
/**Is emitted when a new composer legend has been added*/
|
||||
void composerLegendAdded( QgsComposerLegend* legend );
|
||||
/**Is emitted when a new composer picture has been added*/
|
||||
void composerPictureAdded( QgsComposerPicture* picture );
|
||||
/**Is emitted when a composer item has been removed from the scene*/
|
||||
void itemRemoved( QgsComposerItem* );
|
||||
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
|
||||
|
@ -316,15 +316,7 @@ void QgsComposer::setIconSizes( int size )
|
||||
void QgsComposer::connectSlots()
|
||||
{
|
||||
connect( mView, SIGNAL( selectedItemChanged( QgsComposerItem* ) ), this, SLOT( showItemOptions( QgsComposerItem* ) ) );
|
||||
connect( mView, SIGNAL( composerLabelAdded( QgsComposerLabel* ) ), this, SLOT( addComposerLabel( QgsComposerLabel* ) ) );
|
||||
connect( mView, SIGNAL( composerMapAdded( QgsComposerMap* ) ), this, SLOT( addComposerMap( QgsComposerMap* ) ) );
|
||||
connect( mView, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SLOT( deleteItem( QgsComposerItem* ) ) );
|
||||
connect( mView, SIGNAL( composerScaleBarAdded( QgsComposerScaleBar* ) ), this, SLOT( addComposerScaleBar( QgsComposerScaleBar* ) ) );
|
||||
connect( mView, SIGNAL( composerLegendAdded( QgsComposerLegend* ) ), this, SLOT( addComposerLegend( QgsComposerLegend* ) ) );
|
||||
connect( mView, SIGNAL( composerPictureAdded( QgsComposerPicture* ) ), this, SLOT( addComposerPicture( QgsComposerPicture* ) ) );
|
||||
connect( mView, SIGNAL( composerShapeAdded( QgsComposerShape* ) ), this, SLOT( addComposerShape( QgsComposerShape* ) ) );
|
||||
connect( mView, SIGNAL( composerArrowAdded( QgsComposerArrow* ) ), this, SLOT( addComposerArrow( QgsComposerArrow* ) ) );
|
||||
connect( mView, SIGNAL( composerTableAdded( QgsComposerAttributeTable* ) ), this, SLOT( addComposerTable( QgsComposerAttributeTable* ) ) );
|
||||
connect( mView, SIGNAL( actionFinished() ), this, SLOT( setSelectionTool() ) );
|
||||
|
||||
connect( mComposition, SIGNAL( selectedItemChanged( QgsComposerItem* ) ), this, SLOT( showItemOptions( QgsComposerItem* ) ) );
|
||||
@ -336,6 +328,7 @@ void QgsComposer::connectSlots()
|
||||
connect( mComposition, SIGNAL( composerPictureAdded( QgsComposerPicture* ) ), this, SLOT( addComposerPicture( QgsComposerPicture* ) ) );
|
||||
connect( mComposition, SIGNAL( composerShapeAdded( QgsComposerShape* ) ), this, SLOT( addComposerShape( QgsComposerShape* ) ) );
|
||||
connect( mComposition, SIGNAL( composerTableAdded( QgsComposerAttributeTable* ) ), this, SLOT( addComposerTable( QgsComposerAttributeTable* ) ) );
|
||||
connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SLOT( deleteItem( QgsComposerItem* ) ) );
|
||||
}
|
||||
|
||||
void QgsComposer::open( void )
|
||||
|
@ -1045,3 +1045,65 @@ void QgsComposition::addComposerTable( QgsComposerAttributeTable* table )
|
||||
emit selectedItemChanged( table );
|
||||
//pushAddRemoveCommand( table, tr( "Table added" ) );
|
||||
}
|
||||
|
||||
void QgsComposition::sendItemAddedSignal( QgsComposerItem* item )
|
||||
{
|
||||
//cast and send proper signal
|
||||
item->setSelected( true );
|
||||
QgsComposerArrow* arrow = dynamic_cast<QgsComposerArrow*>( item );
|
||||
if ( arrow )
|
||||
{
|
||||
emit composerArrowAdded( arrow );
|
||||
emit selectedItemChanged( arrow );
|
||||
return;
|
||||
}
|
||||
QgsComposerLabel* label = dynamic_cast<QgsComposerLabel*>( item );
|
||||
if ( label )
|
||||
{
|
||||
emit composerLabelAdded( label );
|
||||
emit selectedItemChanged( label );
|
||||
return;
|
||||
}
|
||||
QgsComposerMap* map = dynamic_cast<QgsComposerMap*>( item );
|
||||
if ( map )
|
||||
{
|
||||
emit composerMapAdded( map );
|
||||
emit selectedItemChanged( map );
|
||||
return;
|
||||
}
|
||||
QgsComposerScaleBar* scalebar = dynamic_cast<QgsComposerScaleBar*>( item );
|
||||
if ( scalebar )
|
||||
{
|
||||
emit composerScaleBarAdded( scalebar );
|
||||
emit selectedItemChanged( scalebar );
|
||||
return;
|
||||
}
|
||||
QgsComposerLegend* legend = dynamic_cast<QgsComposerLegend*>( item );
|
||||
if ( legend )
|
||||
{
|
||||
emit composerLegendAdded( legend );
|
||||
emit selectedItemChanged( legend );
|
||||
return;
|
||||
}
|
||||
QgsComposerPicture* picture = dynamic_cast<QgsComposerPicture*>( item );
|
||||
if ( picture )
|
||||
{
|
||||
emit composerPictureAdded( picture );
|
||||
emit selectedItemChanged( picture );
|
||||
return;
|
||||
}
|
||||
QgsComposerShape* shape = dynamic_cast<QgsComposerShape*>( item );
|
||||
if ( shape )
|
||||
{
|
||||
emit composerShapeAdded( shape );
|
||||
emit selectedItemChanged( shape );
|
||||
return;
|
||||
}
|
||||
QgsComposerAttributeTable* table = dynamic_cast<QgsComposerAttributeTable*>( item );
|
||||
if ( table )
|
||||
{
|
||||
emit composerTableAdded( table );
|
||||
emit selectedItemChanged( table );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +204,10 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
|
||||
/**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/
|
||||
void addComposerTable( QgsComposerAttributeTable* table );
|
||||
|
||||
public slots:
|
||||
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
|
||||
void sendItemAddedSignal( QgsComposerItem* item );
|
||||
|
||||
private:
|
||||
/**Pointer to map renderer of QGIS main map*/
|
||||
QgsMapRenderer* mMapRenderer;
|
||||
@ -267,6 +271,8 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
|
||||
void composerShapeAdded( QgsComposerShape* shape );
|
||||
/**Is emitted when a new composer table has been added*/
|
||||
void composerTableAdded( QgsComposerAttributeTable* table );
|
||||
/**Is emitted when a composer item has been removed from the scene*/
|
||||
void itemRemoved( QgsComposerItem* );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -655,68 +655,6 @@ void QgsComposerView::ungroupItems()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposerView::sendItemAddedSignal( QgsComposerItem* item )
|
||||
{
|
||||
//cast and send proper signal
|
||||
item->setSelected( true );
|
||||
QgsComposerArrow* arrow = dynamic_cast<QgsComposerArrow*>( item );
|
||||
if ( arrow )
|
||||
{
|
||||
emit composerArrowAdded( arrow );
|
||||
emit selectedItemChanged( arrow );
|
||||
return;
|
||||
}
|
||||
QgsComposerLabel* label = dynamic_cast<QgsComposerLabel*>( item );
|
||||
if ( label )
|
||||
{
|
||||
emit composerLabelAdded( label );
|
||||
emit selectedItemChanged( label );
|
||||
return;
|
||||
}
|
||||
QgsComposerMap* map = dynamic_cast<QgsComposerMap*>( item );
|
||||
if ( map )
|
||||
{
|
||||
emit composerMapAdded( map );
|
||||
emit selectedItemChanged( map );
|
||||
return;
|
||||
}
|
||||
QgsComposerScaleBar* scalebar = dynamic_cast<QgsComposerScaleBar*>( item );
|
||||
if ( scalebar )
|
||||
{
|
||||
emit composerScaleBarAdded( scalebar );
|
||||
emit selectedItemChanged( scalebar );
|
||||
return;
|
||||
}
|
||||
QgsComposerLegend* legend = dynamic_cast<QgsComposerLegend*>( item );
|
||||
if ( legend )
|
||||
{
|
||||
emit composerLegendAdded( legend );
|
||||
emit selectedItemChanged( legend );
|
||||
return;
|
||||
}
|
||||
QgsComposerPicture* picture = dynamic_cast<QgsComposerPicture*>( item );
|
||||
if ( picture )
|
||||
{
|
||||
emit composerPictureAdded( picture );
|
||||
emit selectedItemChanged( picture );
|
||||
return;
|
||||
}
|
||||
QgsComposerShape* shape = dynamic_cast<QgsComposerShape*>( item );
|
||||
if ( shape )
|
||||
{
|
||||
emit composerShapeAdded( shape );
|
||||
emit selectedItemChanged( shape );
|
||||
return;
|
||||
}
|
||||
QgsComposerAttributeTable* table = dynamic_cast<QgsComposerAttributeTable*>( item );
|
||||
if ( table )
|
||||
{
|
||||
emit composerTableAdded( table );
|
||||
emit selectedItemChanged( table );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QMainWindow* QgsComposerView::composerWindow()
|
||||
{
|
||||
QMainWindow* composerObject = 0;
|
||||
@ -745,8 +683,12 @@ void QgsComposerView::connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c
|
||||
{
|
||||
return;
|
||||
}
|
||||
QObject::connect( c, SIGNAL( itemRemoved( QgsComposerItem* ) ), this, SIGNAL( itemRemoved( QgsComposerItem* ) ) );
|
||||
QObject::connect( c, SIGNAL( itemAdded( QgsComposerItem* ) ), this, SLOT( sendItemAddedSignal( QgsComposerItem* ) ) );
|
||||
|
||||
if ( composition() )
|
||||
{
|
||||
QObject::connect( c, SIGNAL( itemRemoved( QgsComposerItem* ) ), composition(), SIGNAL( itemRemoved( QgsComposerItem* ) ) );
|
||||
QObject::connect( c, SIGNAL( itemAdded( QgsComposerItem* ) ), composition(), SLOT( sendItemAddedSignal( QgsComposerItem* ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposerView::pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state )
|
||||
|
@ -128,31 +128,9 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
|
||||
|
||||
void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c );
|
||||
|
||||
|
||||
public slots:
|
||||
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
|
||||
void sendItemAddedSignal( QgsComposerItem* item );
|
||||
|
||||
signals:
|
||||
/**Is emitted when selected item changed. If 0, no item is selected*/
|
||||
void selectedItemChanged( QgsComposerItem* selected );
|
||||
/**Is emitted when new composer arrow has been added to the view*/
|
||||
void composerArrowAdded( QgsComposerArrow* arrow );
|
||||
/**Is emitted when new composer label has been added to the view*/
|
||||
void composerLabelAdded( QgsComposerLabel* label );
|
||||
/**Is emitted when new composer map has been added to the view*/
|
||||
void composerMapAdded( QgsComposerMap* map );
|
||||
/**Is emitted when new composer scale bar has been added*/
|
||||
void composerScaleBarAdded( QgsComposerScaleBar* scalebar );
|
||||
/**Is emitted when a new composer legend has been added*/
|
||||
void composerLegendAdded( QgsComposerLegend* legend );
|
||||
/**Is emitted when a new composer picture has been added*/
|
||||
void composerPictureAdded( QgsComposerPicture* picture );
|
||||
/**Is emitted when a new composer shape has been added*/
|
||||
void composerShapeAdded( QgsComposerShape* shape );
|
||||
/**Is emitted when a new composer table has been added*/
|
||||
void composerTableAdded( QgsComposerAttributeTable* table );
|
||||
/**Is emitted when a composer item has been removed from the scene*/
|
||||
void itemRemoved( QgsComposerItem* );
|
||||
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
|
||||
QgsComposer may set the selection tool again*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user