int XGUI_DocumentDataModel::rowCount(const QModelIndex& theParent) const
{
- if (!theParent.isValid())
+ if (!theParent.isValid()) {
+ int aVal = myModel->rowCount(theParent) + myPartModels.size();
return myModel->rowCount(theParent) + myPartModels.size();
-
+ }
QModelIndex aParent = toSourceModelIndex(theParent);
return aParent.model()->rowCount(aParent);
}
int aOffs = myModel->rowCount();
if (theRow < aOffs)
aIndex = myModel->index(theRow, theColumn, theParent);
- else
- aIndex = myPartModels.at(theRow - aOffs)->index(theRow - aOffs, theColumn, theParent);
-
+ else {
+ if (myPartModels.size() > 0) {
+ int aPos = theRow - aOffs;
+ if (aPos >= myPartModels.size())
+ aPos = 0;
+ aIndex = myPartModels.at(aPos)->index(aPos, theColumn, theParent);
+ } else
+ return aIndex;
+ }
aIndex = createIndex(theRow, theColumn, (void*)getModelIndex(aIndex));
} else {
QModelIndex* aParent = (QModelIndex*)theParent.internalPointer();
QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex& theIndex) const
{
QModelIndex aParent = toSourceModelIndex(theIndex);
+ const QAbstractItemModel* a = aParent.model();
aParent = aParent.model()->parent(aParent);
if (aParent.isValid())
return createIndex(aParent.row(), aParent.column(), (void*)getModelIndex(aParent));
#include "XGUI_Viewer.h"
#include "XGUI_WidgetFactory.h"
#include "XGUI_SelectionMgr.h"
+#include "XGUI_ObjectsBrowser.h"
#include <ModelAPI_PluginManager.h>
#include <ModelAPI_Feature.h>
//******************************************************
void XGUI_Workshop::onUndo()
{
+ myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex());
std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
aDoc->undo();
//******************************************************
void XGUI_Workshop::onRedo()
{
+ myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex());
std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
aDoc->redo();