Skip to content

Commit

Permalink
fix #7386
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 18, 2013
1 parent bfde7c8 commit 5743f52
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 39 deletions.
15 changes: 7 additions & 8 deletions src/app/qgsattributedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
tabWidget = new QTabWidget( mDialog );
gridLayout->addWidget( tabWidget );

for ( QList<QgsAttributeEditorElement*>::const_iterator tIt = vl->attributeEditorElements().begin(); tIt != vl->attributeEditorElements().end(); ++tIt )
foreach ( const QgsAttributeEditorElement *widgDef, vl->attributeEditorElements() )
{
QgsAttributeEditorElement* widgDef = *tIt;

QWidget* tabPage = new QWidget( tabWidget );

tabWidget->addTab( tabPage, widgDef->name() );
QGridLayout *tabPageLayout = new QGridLayout( tabPage );

Expand Down Expand Up @@ -230,16 +229,16 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
for ( int fldIdx = 0; fldIdx < theFields.count(); ++fldIdx )
{
QList<QWidget *> myWidgets = mDialog->findChildren<QWidget*>( theFields[fldIdx].name() );
if ( !myWidgets.size() )
if ( myWidgets.isEmpty() )
continue;

for ( QList<QWidget *>::const_iterator itw = myWidgets.begin(); itw != myWidgets.end(); ++itw )
foreach ( QWidget *w, myWidgets )
{
QgsAttributeEditor::createAttributeEditor( mDialog, *itw, vl, fldIdx, myAttributes[fldIdx], mProxyWidgets );
QgsAttributeEditor::createAttributeEditor( mDialog, w, vl, fldIdx, myAttributes[fldIdx], mProxyWidgets );

if ( vl->editType( fldIdx ) != QgsVectorLayer::Immutable )
if ( vl->editType( fldIdx ) != QgsVectorLayer::Immutable && w->isEnabled() )
{
( *itw )->setEnabled(( *itw )->isEnabled() && vl->isEditable() && vl->fieldEditable( fldIdx ) );
w->setEnabled( vl->isEditable() && vl->fieldEditable( fldIdx ) );
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,11 @@ void QgsFieldsProperties::attributeTypeDialog()
QPair<QString, QString> checkStates = mCheckedStates.value( index, mLayer->checkedState( index ) );
attributeTypeDialog.setCheckedState( checkStates.first, checkStates.second );

attributeTypeDialog.setDateFormat( mLayer->dateFormat( index ) );
attributeTypeDialog.setDateFormat( mDateFormat.value( index, mLayer->dateFormat( index ) ) );

attributeTypeDialog.setIndex( index, mEditTypeMap.value( index, mLayer->editType( index ) ) );
attributeTypeDialog.setFieldEditable( mFieldEditables.value( index, mLayer->fieldEditable( index ) ) );

attributeTypeDialog.setFieldEditable( mLayer->fieldEditable( index ) );
attributeTypeDialog.setIndex( index, mEditTypeMap.value( index, mLayer->editType( index ) ) );

if ( !attributeTypeDialog.exec() )
return;
Expand Down
56 changes: 28 additions & 28 deletions src/core/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const QgsComposerItem* QgsComposition::getComposerItemByUuid( QString theUuid, b
}
}
}
return 0;
}
*/
Expand All @@ -313,7 +313,7 @@ const QgsComposerItem* QgsComposition::getComposerItemByUuid( QString theUuid )
}
}
}

return 0;
}

Expand Down Expand Up @@ -491,14 +491,14 @@ bool QgsComposition::loadFromTemplate( const QDomDocument& doc, QMap<QString, QS
return false;
}

// remove all uuid attributes since we don't want duplicates UUIDS
QDomNodeList composerItemsNodes = importDoc.elementsByTagName("ComposerItem");
for (int i=0; i<composerItemsNodes.count(); ++i)
// remove all uuid attributes since we don't want duplicates UUIDS
QDomNodeList composerItemsNodes = importDoc.elementsByTagName( "ComposerItem" );
for ( int i = 0; i < composerItemsNodes.count(); ++i )
{
QDomNode composerItemNode = composerItemsNodes.at(i);
if( composerItemNode.isElement() )
QDomNode composerItemNode = composerItemsNodes.at( i );
if ( composerItemNode.isElement() )
{
composerItemNode.toElement().removeAttribute("uuid");
composerItemNode.toElement().removeAttribute( "uuid" );
}
}

Expand All @@ -514,10 +514,10 @@ bool QgsComposition::loadFromTemplate( const QDomDocument& doc, QMap<QString, QS
void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore,
bool addUndoCommands, QPointF* pos, bool pasteInPlace )
{
QPointF* pasteInPlacePt;
if( pasteInPlace )
QPointF* pasteInPlacePt = 0;
if ( pasteInPlace )
{
pasteInPlacePt = new QPointF(0, pageNumberAt( *pos ) * (mPageHeight+mSpaceBetweenPages) );
pasteInPlacePt = new QPointF( 0, pageNumberAt( *pos ) * ( mPageHeight + mSpaceBetweenPages ) );
}
QDomNodeList composerLabelList = elem.elementsByTagName( "ComposerLabel" );
for ( int i = 0; i < composerLabelList.size(); ++i )
Expand All @@ -527,10 +527,10 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
newLabel->readXML( currentComposerLabelElem, doc );
if ( pos )
{
if ( pasteInPlace )
if ( pasteInPlacePt )
{
newLabel->setItemPosition( newLabel->transform().dx(), fmod(newLabel->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newLabel->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newLabel->setItemPosition( newLabel->transform().dx(), fmod( newLabel->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newLabel->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand Down Expand Up @@ -563,8 +563,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newMap->setItemPosition( newMap->transform().dx(), fmod(newMap->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newMap->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newMap->setItemPosition( newMap->transform().dx(), fmod( newMap->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newMap->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand All @@ -588,8 +588,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newArrow->setItemPosition( newArrow->transform().dx(), fmod(newArrow->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newArrow->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newArrow->setItemPosition( newArrow->transform().dx(), fmod( newArrow->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newArrow->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand All @@ -613,8 +613,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newScaleBar->setItemPosition( newScaleBar->transform().dx(), fmod(newScaleBar->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newScaleBar->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newScaleBar->setItemPosition( newScaleBar->transform().dx(), fmod( newScaleBar->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newScaleBar->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand All @@ -638,8 +638,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newShape->setItemPosition( newShape->transform().dx(), fmod(newShape->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newShape->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newShape->setItemPosition( newShape->transform().dx(), fmod( newShape->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newShape->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand All @@ -663,8 +663,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newPicture->setItemPosition( newPicture->transform().dx(), fmod(newPicture->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newPicture->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newPicture->setItemPosition( newPicture->transform().dx(), fmod( newPicture->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newPicture->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand All @@ -688,8 +688,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newLegend->setItemPosition( newLegend->transform().dx(), fmod(newLegend->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newLegend->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newLegend->setItemPosition( newLegend->transform().dx(), fmod( newLegend->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newLegend->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand All @@ -713,8 +713,8 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
{
if ( pasteInPlace )
{
newTable->setItemPosition( newTable->transform().dx(), fmod(newTable->transform().dy(), (paperHeight()+spaceBetweenPages()) ) );
newTable->move( pasteInPlacePt->x(),pasteInPlacePt->y() );
newTable->setItemPosition( newTable->transform().dx(), fmod( newTable->transform().dy(), ( paperHeight() + spaceBetweenPages() ) ) );
newTable->move( pasteInPlacePt->x(), pasteInPlacePt->y() );
}
else
{
Expand Down

0 comments on commit 5743f52

Please sign in to comment.