mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-03-15 14:53:54 +03:00
TextItem will expand datasource in TextItemEditor if parent band has datasource.
This commit is contained in:
parent
68d2f64c3c
commit
1ade5d0666
@ -141,6 +141,21 @@ void TextItemEditor::initUI()
|
|||||||
ui->gbSettings->setVisible(false);
|
ui->gbSettings->setVisible(false);
|
||||||
connect(ui->twScriptEngine->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
connect(ui->twScriptEngine->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
this, SLOT(slotScriptItemsSelectionChanged(QModelIndex,QModelIndex)));
|
this, SLOT(slotScriptItemsSelectionChanged(QModelIndex,QModelIndex)));
|
||||||
|
|
||||||
|
BandDesignIntf* band = findParentBand();
|
||||||
|
if (band && !band->datasourceName().isEmpty()){
|
||||||
|
QModelIndexList nodes = ui->twData->model()->match(
|
||||||
|
ui->twData->model()->index(0,0),
|
||||||
|
Qt::DisplayRole,
|
||||||
|
band->datasourceName(),
|
||||||
|
2,
|
||||||
|
Qt::MatchRecursive
|
||||||
|
);
|
||||||
|
if (!nodes.isEmpty()){
|
||||||
|
ui->twData->expand(nodes.at(0).parent());
|
||||||
|
ui->twData->expand(nodes.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringListModel *TextItemEditor::getDataSources()
|
QStringListModel *TextItemEditor::getDataSources()
|
||||||
@ -380,4 +395,18 @@ void TextItemEditor::slotScriptItemsSelectionChanged(const QModelIndex &to, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BandDesignIntf *TextItemEditor::findParentBand()
|
||||||
|
{
|
||||||
|
BandDesignIntf* result = 0;
|
||||||
|
BaseDesignIntf* item = m_textItem;
|
||||||
|
while (true){
|
||||||
|
item = dynamic_cast<BaseDesignIntf*>(item->parentItem());
|
||||||
|
if (item){
|
||||||
|
result = dynamic_cast<BandDesignIntf*>(item);
|
||||||
|
if (result) break;
|
||||||
|
} else break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
|
@ -73,6 +73,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *);
|
void resizeEvent(QResizeEvent *);
|
||||||
void moveEvent(QMoveEvent *);
|
void moveEvent(QMoveEvent *);
|
||||||
|
BandDesignIntf* findParentBand();
|
||||||
private slots:
|
private slots:
|
||||||
void on_pbOk_clicked();
|
void on_pbOk_clicked();
|
||||||
void on_pbCancel_clicked();
|
void on_pbCancel_clicked();
|
||||||
|
Loading…
Reference in New Issue
Block a user