Merge pull request #70 from asmaloney/fix-shadows

Fixes some shadowed vars & avoids string copies using const refs
This commit is contained in:
fralx 2017-04-10 11:17:38 +03:00 committed by GitHub
commit a5231058ec
7 changed files with 19 additions and 21 deletions

View File

@ -390,8 +390,8 @@ void HorizontalLayout::slotOnChildDestroy(QObject* child)
BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){
if (m_children.count()<childItems().size()-1){
m_children.clear();
foreach (BaseDesignIntf* item, childBaseItems()) {
m_children.append(item);
foreach (BaseDesignIntf* childItem, childBaseItems()) {
m_children.append(childItem);
}
}
qSort(m_children.begin(),m_children.end(),lessThen);
@ -404,8 +404,8 @@ BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){
BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){
if (m_children.count()<childItems().size()-1){
m_children.clear();
foreach (BaseDesignIntf* item, childBaseItems()) {
m_children.append(item);
foreach (BaseDesignIntf* childItem, childBaseItems()) {
m_children.append(childItem);
}
}
qSort(m_children.begin(),m_children.end(),lessThen);

View File

@ -63,7 +63,7 @@ QString HtmlContext::parseTag(QVector<Tag *> &storage, QString text, int &curPos
tagName.remove('>');
while (buff.contains(rx)){
int pos=rx.indexIn(buff);
pos=rx.indexIn(buff);
buff=buff.right(buff.length()-pos);
curPos+=pos;
if (extractWord(rx.cap(0),1).compare(extractWord(tagName,1),Qt::CaseInsensitive)==0){

View File

@ -124,8 +124,8 @@ void TextItemEditor::initUI()
ui->twData->setModel(dm->datasourcesModel());
ui->twScriptEngine->setModel(se.model());
foreach(QString dsName,dm->dataSourceNames()){
foreach(QString field, dm->fieldNames(dsName)){
foreach(const QString &dsName,dm->dataSourceNames()){
foreach(const QString &field, dm->fieldNames(dsName)){
dataWords<<dsName+"."+field;
}
}

View File

@ -704,7 +704,6 @@ int CallbackDatasource::columnCount(){
int currIndex = 0;
do {
QVariant columnName;
CallbackInfo info;
info.dataType = CallbackInfo::ColumnHeaderData;
info.index = currIndex;
emit getCallbackData(info,columnName);

View File

@ -1729,8 +1729,8 @@ CommandIf::Ptr DeleteLayoutCommand::create(PageDesignIntf *page, LayoutDesignInt
DeleteLayoutCommand* command = new DeleteLayoutCommand();
command->setPage(page);
command->setItem(item);
foreach (BaseDesignIntf* item, item->childBaseItems()){
command->m_childItems.append(item->objectName());
foreach (BaseDesignIntf* childItem, item->childBaseItems()){
command->m_childItems.append(childItem->objectName());
}
return CommandIf::Ptr(command);
}

View File

@ -335,7 +335,7 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band)
foreach(BaseDesignIntf* item,band->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem&&(contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}")))){
foreach(QString functionName, m_datasources->groupFunctionNames()){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
if (rx.indexIn(contentItem->content())>=0){
@ -373,7 +373,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem){
QString content = contentItem->content();
foreach(QString functionName, m_datasources->groupFunctionNames()){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
if (rx.indexIn(content)>=0){
int pos = 0;

View File

@ -106,7 +106,6 @@ bool XMLReader::readItem(QObject *item)
void XMLReader::readItemFromNode(QObject* item,QDomElement *node)
{
ObjectLoadingStateIntf* lf = dynamic_cast<ObjectLoadingStateIntf*>(item);
if(lf) lf->objectLoadStarted();
for (int i=0;i<node->childNodes().count();i++){
@ -123,8 +122,8 @@ void XMLReader::readItemFromNode(QObject* item,QDomElement *node)
BaseDesignIntf* baseObj = dynamic_cast<BaseDesignIntf*>(item);
if(baseObj) {
foreach(QGraphicsItem* item,baseObj->childItems()){
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(item);
foreach(QGraphicsItem* childItem,baseObj->childItems()){
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(childItem);
if (baseItem) baseItem->parentObjectLoadFinished();
}
}