I'm a newbie in QCAD, but not in CAD Developement. So I try port some old and tested Features like a Layer Manager to QCAD. At first I want get a feeling for the system, specifically the Transaction system. I wrote this code:
RDocumentInterface *di = RMainWindow::getDocumentInterfaceStatic(); if(di) { RDocument &document = di->getDocument(); QSet<RLayer::Id> LayerSet = document.queryAllLayers(); foreach(RLayer::Id theLayerID, LayerSet) { QSharedPointer<RLayer> theLayer = document.queryLayer(theLayerID); if(!theLayer.isNull()) { // For testing I pick a layer, but on the end I want traverse the whole layer tabel if(Globals::getLyrNmSeamData() == theLayer->getName()) { RTransaction theTransaction(document.getStorage(), QObject::tr("Set layer properties"), false); theLayer->setFrozen(false); theLayer->setLocked(false); theTransaction.addObject(theLayer, false); // true hasn't any effect in this kind theTransaction.end(); document.setCurrentLayer(theLayerID); break; } } } di->regenerateScenes() ; // Important if you want see the changes on the screen }A lot work. The Current Layer was changed. I can draw entities and can see them. But the old entities was not shown, even during I draw a new line, too. I try call methods from notify system but no effect. I search in internet an look in this board. Then I found the reason as I inspect the DocumentInterface class. I'm sure before that I have to find a method for rebuild the internal display lists. A call of regenerateScenes() was the solution.