mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 20:44:39 +03:00
ObjectInspector has been wrapped by QWidget
This commit is contained in:
parent
5f9ee85dba
commit
4208b98f4a
@ -503,31 +503,16 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivateInterface* report)
|
|||||||
void ReportDesignWindow::createObjectInspector()
|
void ReportDesignWindow::createObjectInspector()
|
||||||
{
|
{
|
||||||
m_objectInspector = new ObjectInspectorWidget(this);
|
m_objectInspector = new ObjectInspectorWidget(this);
|
||||||
m_propertyModel = new BaseDesignPropertyModel(this);
|
//m_propertyModel = new BaseDesignPropertyModel(this);
|
||||||
m_validator = new ObjectNameValidator();
|
m_validator = new ObjectNameValidator();
|
||||||
m_propertyModel->setValidator(m_validator);
|
m_objectInspector->setValidator(m_validator);
|
||||||
m_propertyModel->setSubclassesAsLevel(false);
|
m_objectInspector->setSubclassesAsLevel(false);
|
||||||
m_filterModel = new PropertyFilterModel(this);
|
//m_objectInspector->setModel(m_propertyModel);
|
||||||
m_filterModel->setSourceModel(m_propertyModel);
|
|
||||||
m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString));
|
|
||||||
m_filterModel->setRecursiveFilteringEnabled(false);
|
|
||||||
m_objectInspector->setModel(m_filterModel);
|
|
||||||
m_objectInspector->setAlternatingRowColors(true);
|
m_objectInspector->setAlternatingRowColors(true);
|
||||||
m_objectInspector->setRootIsDecorated(!m_propertyModel->subclassesAsLevel());
|
m_objectInspector->setRootIsDecorated(!m_objectInspector->subclassesAsLevel());
|
||||||
QDockWidget *objectDoc = new QDockWidget(this);
|
QDockWidget *objectDoc = new QDockWidget(this);
|
||||||
QWidget* w = new QWidget(objectDoc);
|
QWidget* w = new QWidget(objectDoc);
|
||||||
QVBoxLayout* l = new QVBoxLayout(w);
|
QVBoxLayout* l = new QVBoxLayout(w);
|
||||||
QLineEdit* le = new QLineEdit(w);
|
|
||||||
QPushButton * pbClear = new QPushButton(QIcon(":/items/clear.png"),"",w);
|
|
||||||
pbClear->setToolTip(tr("Clear"));
|
|
||||||
connect(pbClear, SIGNAL(clicked()), le, SLOT(clear()));
|
|
||||||
le->setPlaceholderText(tr("Filter"));
|
|
||||||
connect(le, SIGNAL(textChanged(const QString&)), this, SLOT(slotFilterTextChanged(const QString&)));
|
|
||||||
QHBoxLayout* h = new QHBoxLayout();
|
|
||||||
h->setSpacing(2);
|
|
||||||
h->addWidget(le);
|
|
||||||
h->addWidget(pbClear);
|
|
||||||
l->addLayout(h);
|
|
||||||
l->addWidget(m_objectInspector);
|
l->addWidget(m_objectInspector);
|
||||||
l->setContentsMargins(2,2,2,2);
|
l->setContentsMargins(2,2,2,2);
|
||||||
w->setLayout(l);
|
w->setLayout(l);
|
||||||
@ -707,11 +692,11 @@ void ReportDesignWindow::writeState()
|
|||||||
setDocWidgetsVisibility(true);
|
setDocWidgetsVisibility(true);
|
||||||
|
|
||||||
m_editorsStates[m_editorTabType] = saveState();
|
m_editorsStates[m_editorTabType] = saveState();
|
||||||
settings()->setValue("PageEditorsState", m_editorsStates[ReportDesignWidget::Page]);
|
settings()->setValue("PageEditorsState", m_editorsStates[ReportDesignWidget::Page]);
|
||||||
settings()->setValue("DialogEditorsState", m_editorsStates[ReportDesignWidget::Dialog]);
|
settings()->setValue("DialogEditorsState", m_editorsStates[ReportDesignWidget::Dialog]);
|
||||||
settings()->setValue("ScriptEditorsState", m_editorsStates[ReportDesignWidget::Script]);
|
settings()->setValue("ScriptEditorsState", m_editorsStates[ReportDesignWidget::Script]);
|
||||||
settings()->setValue("TranslationEditorsState", m_editorsStates[ReportDesignWidget::Translations]);
|
settings()->setValue("TranslationEditorsState", m_editorsStates[ReportDesignWidget::Translations]);
|
||||||
settings()->setValue("InspectorFirsColumnWidth",m_objectInspector->columnWidth(0));
|
settings()->setValue("InspectorFirsColumnWidth", m_objectInspector->columnWidth(0));
|
||||||
settings()->endGroup();
|
settings()->endGroup();
|
||||||
settings()->beginGroup("RecentFiles");
|
settings()->beginGroup("RecentFiles");
|
||||||
settings()->setValue("filesCount",m_recentFiles.count());
|
settings()->setValue("filesCount",m_recentFiles.count());
|
||||||
@ -950,7 +935,7 @@ void ReportDesignWindow::slotNewBand(int bandType)
|
|||||||
|
|
||||||
void ReportDesignWindow::slotItemSelected(LimeReport::BaseDesignIntf *item)
|
void ReportDesignWindow::slotItemSelected(LimeReport::BaseDesignIntf *item)
|
||||||
{
|
{
|
||||||
if (m_propertyModel->currentObject()!=item){
|
if (m_objectInspector->currentObject()!=item){
|
||||||
|
|
||||||
m_newSubDetail->setEnabled(false);
|
m_newSubDetail->setEnabled(false);
|
||||||
m_newSubDetailHeader->setEnabled(false);
|
m_newSubDetailHeader->setEnabled(false);
|
||||||
@ -961,9 +946,9 @@ void ReportDesignWindow::slotItemSelected(LimeReport::BaseDesignIntf *item)
|
|||||||
m_newDataFooter->setEnabled(false);
|
m_newDataFooter->setEnabled(false);
|
||||||
|
|
||||||
m_objectInspector->commitActiveEditorData();
|
m_objectInspector->commitActiveEditorData();
|
||||||
m_propertyModel->setObject(item);
|
m_objectInspector->setObject(item);
|
||||||
|
|
||||||
if (m_propertyModel->subclassesAsLevel())
|
if (m_objectInspector->subclassesAsLevel())
|
||||||
m_objectInspector->expandToDepth(0);
|
m_objectInspector->expandToDepth(0);
|
||||||
|
|
||||||
QSet<BandDesignIntf::BandsType> bs;
|
QSet<BandDesignIntf::BandsType> bs;
|
||||||
@ -997,7 +982,7 @@ void ReportDesignWindow::slotItemSelected(LimeReport::BaseDesignIntf *item)
|
|||||||
m_fontEditorBar->setItem(item);
|
m_fontEditorBar->setItem(item);
|
||||||
m_textAlignmentEditorBar->setItem(item);
|
m_textAlignmentEditorBar->setItem(item);
|
||||||
m_itemsBordersEditorBar->setItem(item);
|
m_itemsBordersEditorBar->setItem(item);
|
||||||
} else {m_propertyModel->clearObjectsList();}
|
} else {m_objectInspector->clearObjectsList();}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportDesignWindow::slotItemPropertyChanged(const QString &objectName, const QString &propertyName, const QVariant& oldValue, const QVariant& newValue )
|
void ReportDesignWindow::slotItemPropertyChanged(const QString &objectName, const QString &propertyName, const QVariant& oldValue, const QVariant& newValue )
|
||||||
@ -1005,8 +990,8 @@ void ReportDesignWindow::slotItemPropertyChanged(const QString &objectName, cons
|
|||||||
Q_UNUSED(oldValue)
|
Q_UNUSED(oldValue)
|
||||||
Q_UNUSED(newValue)
|
Q_UNUSED(newValue)
|
||||||
|
|
||||||
if (m_propertyModel->currentObject()&&(m_propertyModel->currentObject()->objectName()==objectName)){
|
if (m_objectInspector->currentObject()&&(m_objectInspector->currentObject()->objectName()==objectName)){
|
||||||
m_propertyModel->updateProperty(propertyName);
|
m_objectInspector->updateProperty(propertyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1019,8 +1004,8 @@ void ReportDesignWindow::slotMultiItemSelected()
|
|||||||
QObject* oi = dynamic_cast<QObject*>(gi);
|
QObject* oi = dynamic_cast<QObject*>(gi);
|
||||||
if (oi) selectionList.append(oi);
|
if (oi) selectionList.append(oi);
|
||||||
}
|
}
|
||||||
m_propertyModel->setMultiObjects(&selectionList);
|
m_objectInspector->setMultiObjects(&selectionList);
|
||||||
if (m_propertyModel->subclassesAsLevel())
|
if (m_objectInspector->subclassesAsLevel())
|
||||||
m_objectInspector->expandToDepth(0);
|
m_objectInspector->expandToDepth(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1112,7 +1097,7 @@ void ReportDesignWindow::slotLoadReport()
|
|||||||
m_reportDesignWidget->clear();
|
m_reportDesignWidget->clear();
|
||||||
if (m_reportDesignWidget->loadFromFile(fileName)){
|
if (m_reportDesignWidget->loadFromFile(fileName)){
|
||||||
m_lblReportName->setText(fileName);
|
m_lblReportName->setText(fileName);
|
||||||
m_propertyModel->setObject(0);
|
m_objectInspector->setObject(0);
|
||||||
updateRedoUndo();
|
updateRedoUndo();
|
||||||
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
|
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
|
||||||
if (!m_recentFiles.contains(fileName)){
|
if (!m_recentFiles.contains(fileName)){
|
||||||
@ -1336,7 +1321,7 @@ void ReportDesignWindow::showDefaultEditors(){
|
|||||||
|
|
||||||
void ReportDesignWindow::slotActivePageChanged()
|
void ReportDesignWindow::slotActivePageChanged()
|
||||||
{
|
{
|
||||||
m_propertyModel->setObject(0);
|
m_objectInspector->setObject(0);
|
||||||
updateRedoUndo();
|
updateRedoUndo();
|
||||||
updateAvaibleBands();
|
updateAvaibleBands();
|
||||||
|
|
||||||
@ -1464,7 +1449,7 @@ void ReportDesignWindow::slotLoadRecentFile(const QString fileName)
|
|||||||
m_reportDesignWidget->clear();
|
m_reportDesignWidget->clear();
|
||||||
m_reportDesignWidget->loadFromFile(fileName);
|
m_reportDesignWidget->loadFromFile(fileName);
|
||||||
m_lblReportName->setText(fileName);
|
m_lblReportName->setText(fileName);
|
||||||
m_propertyModel->setObject(0);
|
m_objectInspector->setObject(0);
|
||||||
updateRedoUndo();
|
updateRedoUndo();
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
|
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
|
||||||
@ -1563,12 +1548,5 @@ bool ObjectNameValidator::validate(const QString &propName, const QVariant &prop
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
|
||||||
{
|
|
||||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
|
||||||
if (sourceParent.isValid()) return true;
|
|
||||||
return sourceModel()->data(index).toString().contains(filterRegExp());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ private:
|
|||||||
QSignalMapper* m_recentFilesSignalMap;
|
QSignalMapper* m_recentFilesSignalMap;
|
||||||
|
|
||||||
ObjectInspectorWidget* m_objectInspector;
|
ObjectInspectorWidget* m_objectInspector;
|
||||||
QObjectPropertyModel* m_propertyModel;
|
//QObjectPropertyModel* m_propertyModel;
|
||||||
|
|
||||||
ReportDesignWidget* m_reportDesignWidget;
|
ReportDesignWidget* m_reportDesignWidget;
|
||||||
DataBrowser * m_dataBrowser;
|
DataBrowser * m_dataBrowser;
|
||||||
@ -281,12 +281,5 @@ class ObjectNameValidator : public ValidatorIntf{
|
|||||||
bool validate(const QString &propName, const QVariant &propValue, QObject *object, QString &msg);
|
bool validate(const QString &propName, const QVariant &propValue, QObject *object, QString &msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PropertyFilterModel: public QSortFilterProxyModel{
|
|
||||||
public:
|
|
||||||
PropertyFilterModel(QObject* parent = 0): QSortFilterProxyModel(parent){}
|
|
||||||
protected:
|
|
||||||
bool filterAcceptsRow(int sourceRow,const QModelIndex &sourceParent) const;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
#endif // LRREPORTEDITORWINDOW_H
|
#endif // LRREPORTEDITORWINDOW_H
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "lrglobal.h"
|
#include "lrglobal.h"
|
||||||
#include "lrobjectinspectorwidget.h"
|
#include "lrobjectinspectorwidget.h"
|
||||||
@ -37,7 +41,7 @@
|
|||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
ObjectInspectorTreeView::ObjectInspectorTreeView(QWidget *parent)
|
||||||
:QTreeView(parent), m_propertyDelegate(0)
|
:QTreeView(parent), m_propertyDelegate(0)
|
||||||
{
|
{
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
@ -54,9 +58,9 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
|||||||
setPalette(p);
|
setPalette(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectInspectorWidget::~ObjectInspectorWidget(){}
|
ObjectInspectorTreeView::~ObjectInspectorTreeView(){}
|
||||||
|
|
||||||
void ObjectInspectorWidget::drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const
|
void ObjectInspectorTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
ObjectPropItem *node = nodeFromIndex(index);
|
ObjectPropItem *node = nodeFromIndex(index);
|
||||||
StyleOptionViewItem so = options;
|
StyleOptionViewItem so = options;
|
||||||
@ -84,7 +88,7 @@ void ObjectInspectorWidget::drawRow(QPainter *painter, const QStyleOptionViewIte
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectInspectorWidget::mousePressEvent(QMouseEvent *event)
|
void ObjectInspectorTreeView::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((event->button()==Qt::LeftButton)){
|
if ((event->button()==Qt::LeftButton)){
|
||||||
@ -106,7 +110,7 @@ void ObjectInspectorWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
QTreeView::mousePressEvent(event);
|
QTreeView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectInspectorWidget::initColorMap()
|
void ObjectInspectorTreeView::initColorMap()
|
||||||
{
|
{
|
||||||
m_colors.reserve(6);
|
m_colors.reserve(6);
|
||||||
m_colors.push_back(QColor(255,230,191));
|
m_colors.push_back(QColor(255,230,191));
|
||||||
@ -117,12 +121,12 @@ void ObjectInspectorWidget::initColorMap()
|
|||||||
m_colors.push_back(QColor(255,191,239));
|
m_colors.push_back(QColor(255,191,239));
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor ObjectInspectorWidget::getColor(const int index) const
|
QColor ObjectInspectorTreeView::getColor(const int index) const
|
||||||
{
|
{
|
||||||
return m_colors[index];
|
return m_colors[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectInspectorWidget::reset()
|
void ObjectInspectorTreeView::reset()
|
||||||
{
|
{
|
||||||
QTreeView::reset();
|
QTreeView::reset();
|
||||||
for (int i=0;i<model()->rowCount();i++){
|
for (int i=0;i<model()->rowCount();i++){
|
||||||
@ -132,12 +136,12 @@ void ObjectInspectorWidget::reset()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectPropItem * ObjectInspectorWidget::nodeFromIndex(QModelIndex index) const
|
ObjectPropItem * ObjectInspectorTreeView::nodeFromIndex(QModelIndex index) const
|
||||||
{
|
{
|
||||||
return qvariant_cast<LimeReport::ObjectPropItem*>(index.data(Qt::UserRole));
|
return qvariant_cast<LimeReport::ObjectPropItem*>(index.data(Qt::UserRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectInspectorWidget::keyPressEvent(QKeyEvent *event)
|
void ObjectInspectorTreeView::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if (event->key()==Qt::Key_Return){
|
if (event->key()==Qt::Key_Return){
|
||||||
if(!m_propertyDelegate->isEditing()){
|
if(!m_propertyDelegate->isEditing()){
|
||||||
@ -149,10 +153,125 @@ void ObjectInspectorWidget::keyPressEvent(QKeyEvent *event)
|
|||||||
} else QTreeView::keyPressEvent(event);
|
} else QTreeView::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectInspectorWidget::commitActiveEditorData(){
|
void ObjectInspectorTreeView::commitActiveEditorData(){
|
||||||
if (state()==QAbstractItemView::EditingState){
|
if (state()==QAbstractItemView::EditingState){
|
||||||
commitData(indexWidget(currentIndex()));
|
commitData(indexWidget(currentIndex()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||||
|
{
|
||||||
|
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||||
|
if (sourceParent.isValid()) return true;
|
||||||
|
return sourceModel()->data(index).toString().contains(filterRegExp());
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
||||||
|
:QWidget(parent), m_filterModel(0)
|
||||||
|
{
|
||||||
|
m_objectInspectorView = new ObjectInspectorTreeView(this);
|
||||||
|
m_propertyModel = new BaseDesignPropertyModel(this);
|
||||||
|
m_filterModel = new PropertyFilterModel(this);
|
||||||
|
m_filterModel->setSourceModel(m_propertyModel);
|
||||||
|
m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString));
|
||||||
|
m_objectInspectorView->setModel(m_filterModel);
|
||||||
|
QVBoxLayout* l = new QVBoxLayout();
|
||||||
|
QLineEdit* le = new QLineEdit(this);
|
||||||
|
QPushButton * pbClear = new QPushButton(QIcon(":/items/clear.png"),"",this);
|
||||||
|
pbClear->setToolTip(tr("Clear"));
|
||||||
|
connect(pbClear, SIGNAL(clicked()), le, SLOT(clear()));
|
||||||
|
le->setPlaceholderText(tr("Filter"));
|
||||||
|
connect(le, SIGNAL(textChanged(const QString&)), this, SLOT(slotFilterTextChanged(const QString&)));
|
||||||
|
QHBoxLayout* h = new QHBoxLayout();
|
||||||
|
h->setSpacing(2);
|
||||||
|
h->addWidget(le);
|
||||||
|
h->addWidget(pbClear);
|
||||||
|
l->addLayout(h);
|
||||||
|
l->addWidget(m_objectInspectorView);
|
||||||
|
l->setContentsMargins(2,2,2,2);
|
||||||
|
this->setLayout(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setModel(QAbstractItemModel *model)
|
||||||
|
{
|
||||||
|
|
||||||
|
m_filterModel->setSourceModel(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setAlternatingRowColors(bool value)
|
||||||
|
{
|
||||||
|
m_objectInspectorView->setAlternatingRowColors(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setRootIsDecorated(bool value)
|
||||||
|
{
|
||||||
|
m_objectInspectorView->setRootIsDecorated(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setColumnWidth(int column, int width)
|
||||||
|
{
|
||||||
|
m_objectInspectorView->setColumnWidth(column, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ObjectInspectorWidget::columnWidth(int column)
|
||||||
|
{
|
||||||
|
return m_objectInspectorView->columnWidth(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::expandToDepth(int depth)
|
||||||
|
{
|
||||||
|
m_objectInspectorView->expandToDepth(depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::commitActiveEditorData()
|
||||||
|
{
|
||||||
|
m_objectInspectorView->commitActiveEditorData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setValidator(ValidatorIntf *validator)
|
||||||
|
{
|
||||||
|
m_propertyModel->setValidator(validator);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ObjectInspectorWidget::subclassesAsLevel()
|
||||||
|
{
|
||||||
|
return m_propertyModel->subclassesAsLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setSubclassesAsLevel(bool value)
|
||||||
|
{
|
||||||
|
m_propertyModel->setSubclassesAsLevel(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QObject *ObjectInspectorWidget::currentObject(){
|
||||||
|
return m_propertyModel->currentObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setObject(QObject *object)
|
||||||
|
{
|
||||||
|
m_propertyModel->setObject(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::setMultiObjects(QList<QObject *> *list)
|
||||||
|
{
|
||||||
|
m_propertyModel->setMultiObjects(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::clearObjectsList()
|
||||||
|
{
|
||||||
|
m_propertyModel->clearObjectsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::updateProperty(const QString &propertyName)
|
||||||
|
{
|
||||||
|
m_propertyModel->updateProperty(propertyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInspectorWidget::slotFilterTextChanged(const QString &filter)
|
||||||
|
{
|
||||||
|
if (m_filterModel)
|
||||||
|
m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString));
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
|
@ -32,17 +32,20 @@
|
|||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "lrobjectitemmodel.h"
|
#include "lrobjectitemmodel.h"
|
||||||
|
#include "lrbasedesignobjectmodel.h"
|
||||||
#include "lrpropertydelegate.h"
|
#include "lrpropertydelegate.h"
|
||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
class ObjectInspectorWidget : public QTreeView
|
class ObjectInspectorTreeView : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ObjectInspectorWidget(QWidget * parent=0);
|
ObjectInspectorTreeView(QWidget * parent=0);
|
||||||
~ObjectInspectorWidget();
|
~ObjectInspectorTreeView();
|
||||||
QColor getColor(const int index) const;
|
QColor getColor(const int index) const;
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
virtual void commitActiveEditorData();
|
virtual void commitActiveEditorData();
|
||||||
@ -59,6 +62,40 @@ private:
|
|||||||
PropertyDelegate *m_propertyDelegate;
|
PropertyDelegate *m_propertyDelegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PropertyFilterModel: public QSortFilterProxyModel{
|
||||||
|
public:
|
||||||
|
PropertyFilterModel(QObject* parent = 0): QSortFilterProxyModel(parent){}
|
||||||
|
protected:
|
||||||
|
bool filterAcceptsRow(int sourceRow,const QModelIndex &sourceParent) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ObjectInspectorWidget: public QWidget{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ObjectInspectorWidget(QWidget* parent = 0);
|
||||||
|
void setModel(QAbstractItemModel* model);
|
||||||
|
void setAlternatingRowColors(bool value);
|
||||||
|
void setRootIsDecorated(bool value);
|
||||||
|
void setColumnWidth(int column, int width);
|
||||||
|
int columnWidth(int column);
|
||||||
|
void expandToDepth(int depth);
|
||||||
|
void commitActiveEditorData();
|
||||||
|
void setValidator(ValidatorIntf *validator);
|
||||||
|
bool subclassesAsLevel();
|
||||||
|
void setSubclassesAsLevel(bool value);
|
||||||
|
void setObject(QObject* object);
|
||||||
|
const QObject* currentObject();
|
||||||
|
void setMultiObjects(QList<QObject *>* list);
|
||||||
|
void clearObjectsList();
|
||||||
|
void updateProperty(const QString &propertyName);
|
||||||
|
private slots:
|
||||||
|
void slotFilterTextChanged(const QString& filter);
|
||||||
|
private:
|
||||||
|
ObjectInspectorTreeView* m_objectInspectorView;
|
||||||
|
QSortFilterProxyModel* m_filterModel;
|
||||||
|
BaseDesignPropertyModel* m_propertyModel;
|
||||||
|
};
|
||||||
|
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
|
|
||||||
#endif // LROBJECTINSPECTORWIDGET_H
|
#endif // LROBJECTINSPECTORWIDGET_H
|
||||||
|
@ -173,7 +173,7 @@ void LimeReport::PropertyDelegate::updateEditorGeometry(QWidget *editor, const Q
|
|||||||
if (m_editingItem) m_editingItem->updateEditorGeometry(editor,option,index);
|
if (m_editingItem) m_editingItem->updateEditorGeometry(editor,option,index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeReport::PropertyDelegate::setObjectInspector(ObjectInspectorWidget* objectInspector)
|
void LimeReport::PropertyDelegate::setObjectInspector(ObjectInspectorTreeView* objectInspector)
|
||||||
{
|
{
|
||||||
m_objectInspector=objectInspector;
|
m_objectInspector=objectInspector;
|
||||||
}
|
}
|
||||||
|
@ -39,14 +39,14 @@
|
|||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
class ObjectInspectorWidget;
|
class ObjectInspectorTreeView;
|
||||||
//class PropertyDelegate : public QItemDelegate
|
//class PropertyDelegate : public QItemDelegate
|
||||||
class PropertyDelegate : public QStyledItemDelegate
|
class PropertyDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PropertyDelegate(QObject *parent=0);
|
PropertyDelegate(QObject *parent=0);
|
||||||
void setObjectInspector(ObjectInspectorWidget* objectInspector);
|
void setObjectInspector(ObjectInspectorTreeView* objectInspector);
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
@ -60,7 +60,7 @@ private slots:
|
|||||||
void slotEditorDeleted();
|
void slotEditorDeleted();
|
||||||
void slotItemDeleted(QObject* item);
|
void slotItemDeleted(QObject* item);
|
||||||
private:
|
private:
|
||||||
LimeReport::ObjectInspectorWidget* m_objectInspector;
|
LimeReport::ObjectInspectorTreeView* m_objectInspector;
|
||||||
mutable LimeReport::ObjectPropItem* m_editingItem;
|
mutable LimeReport::ObjectPropItem* m_editingItem;
|
||||||
mutable bool m_isEditing;
|
mutable bool m_isEditing;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user