Bands movement has been fixed

This commit is contained in:
Arin Alexander
2019-03-04 22:33:01 +03:00
parent bc8750e5d4
commit 6cad2bd6db
7 changed files with 77 additions and 34 deletions

View File

@@ -379,10 +379,23 @@ int BandDesignIntf::maxChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands)
return curIndex;
}
int BandDesignIntf::rootIndex(BandDesignIntf* parentBand)
{
return rootBand(parentBand)->bandIndex();
}
BandDesignIntf *BandDesignIntf::rootBand(BandDesignIntf* parentBand)
{
BandDesignIntf* currentBand = this;
while (currentBand->parentBand() && currentBand->parentBand() != parentBand)
currentBand = currentBand->parentBand();
return currentBand;
}
int BandDesignIntf::minChildIndex(BandDesignIntf::BandsType bandType){
int curIndex = bandIndex();
foreach(BandDesignIntf* childBand, childBands()){
if (curIndex>childBand->bandIndex() && (childBand->bandType()>bandType)){
if (curIndex > childBand->bandIndex() && (childBand->bandType() > bandType)){
curIndex = childBand->bandIndex();
}
}
@@ -394,7 +407,7 @@ int BandDesignIntf::minChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands)
int curIndex = bandIndex();
foreach(BandDesignIntf* childBand, childBands()){
if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex() < bandIndex()){
curIndex = std::min(curIndex, childBand->maxChildIndex(ignoredBands));
curIndex = std::min(curIndex, childBand->minChildIndex(ignoredBands));
}
}
return curIndex;