@@ -245,11 +245,12 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
245
245
mLayerSrsId = mProjectSrsId ;
246
246
}
247
247
248
- twIdentifyLayers->setColumnCount ( 3 );
248
+ twIdentifyLayers->setColumnCount ( 4 );
249
249
twIdentifyLayers->horizontalHeader ()->setVisible ( true );
250
250
twIdentifyLayers->setHorizontalHeaderItem ( 0 , new QTableWidgetItem ( tr ( " Layer" ) ) );
251
251
twIdentifyLayers->setHorizontalHeaderItem ( 1 , new QTableWidgetItem ( tr ( " Type" ) ) );
252
252
twIdentifyLayers->setHorizontalHeaderItem ( 2 , new QTableWidgetItem ( tr ( " Identifiable" ) ) );
253
+ twIdentifyLayers->setHorizontalHeaderItem ( 3 , new QTableWidgetItem ( tr ( " Read Only" ) ) );
253
254
twIdentifyLayers->setRowCount ( mapLayers.size () );
254
255
twIdentifyLayers->verticalHeader ()->setResizeMode ( QHeaderView::ResizeToContents );
255
256
@@ -289,9 +290,16 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
289
290
twi->setFlags ( twi->flags () & ~Qt::ItemIsEditable );
290
291
twIdentifyLayers->setItem ( i, 1 , twi );
291
292
292
- QCheckBox *cb = new QCheckBox ();
293
- cb->setChecked ( !noIdentifyLayerIdList.contains ( currentLayer->id () ) );
294
- twIdentifyLayers->setCellWidget ( i, 2 , cb );
293
+ QCheckBox *cbIdentify = new QCheckBox ();
294
+ cbIdentify->setChecked ( !noIdentifyLayerIdList.contains ( currentLayer->id () ) );
295
+ twIdentifyLayers->setCellWidget ( i, 2 , cbIdentify );
296
+
297
+ twi = new QTableWidgetItem ( type );
298
+ twi->setFlags ( twi->flags () & ~Qt::ItemIsEditable );
299
+ QCheckBox *cbReadOnly = new QCheckBox ();
300
+ cbReadOnly->setChecked ( currentLayer->readOnly () );
301
+ cbReadOnly->setEnabled ( currentLayer->type () == QgsMapLayer::VectorLayer );
302
+ twIdentifyLayers->setCellWidget ( i, 3 , cbReadOnly );
295
303
}
296
304
297
305
grpOWSServiceCapabilities->setChecked ( QgsProject::instance ()->readBoolEntry ( " WMSServiceCapabilities" , " /" , false ) );
@@ -880,12 +888,17 @@ void QgsProjectProperties::apply()
880
888
QStringList noIdentifyLayerList;
881
889
for ( int i = 0 ; i < twIdentifyLayers->rowCount (); i++ )
882
890
{
883
- QCheckBox *cb = qobject_cast<QCheckBox *>( twIdentifyLayers->cellWidget ( i, 2 ) );
884
- if ( cb && !cb->isChecked () )
891
+ QString id = twIdentifyLayers->item ( i, 0 )->data ( Qt::UserRole ).toString ();
892
+
893
+ QCheckBox *cbIdentify = qobject_cast<QCheckBox *>( twIdentifyLayers->cellWidget ( i, 2 ) );
894
+ if ( cbIdentify && !cbIdentify->isChecked () )
885
895
{
886
- QString id = twIdentifyLayers->item ( i, 0 )->data ( Qt::UserRole ).toString ();
887
896
noIdentifyLayerList << id;
888
897
}
898
+ QCheckBox *cbReadOnly = qobject_cast<QCheckBox *>( twIdentifyLayers->cellWidget ( i, 3 ) );
899
+ QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance ()->mapLayer ( id ) );
900
+ if ( vl )
901
+ vl->setReadOnly ( cbReadOnly->checkState () == Qt::Checked );
889
902
}
890
903
891
904
QgsProject::instance ()->setNonIdentifiableLayers ( noIdentifyLayerList );
0 commit comments