mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Finish 1.4.79
This commit is contained in:
commit
ee9450697b
@ -77,8 +77,8 @@ void LimeReport::ItemLocationPropItem::setPropertyEditorData(QWidget *propertyEd
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LimeReport::ItemLocationPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index){
|
void LimeReport::ItemLocationPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index){
|
||||||
object()->setProperty(propertyName().toLatin1(),stringToLocation(qobject_cast<ComboBoxEditor*>(propertyEditor)->text()));
|
|
||||||
model->setData(index,object()->property(propertyName().toLatin1()));
|
model->setData(index,object()->property(propertyName().toLatin1()));
|
||||||
|
setValueToObject(propertyName(), propertyValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LimeReport::ItemLocationPropItem::locationToString(LimeReport::ItemDesignIntf::LocationType location) const{
|
QString LimeReport::ItemLocationPropItem::locationToString(LimeReport::ItemDesignIntf::LocationType location) const{
|
||||||
@ -92,6 +92,5 @@ LimeReport::ItemDesignIntf::LocationType LimeReport::ItemLocationPropItem::strin
|
|||||||
void LimeReport::ItemLocationPropItem::slotLocationChanged(const QString &text){
|
void LimeReport::ItemLocationPropItem::slotLocationChanged(const QString &text){
|
||||||
if ( locationToString(object()->property(propertyName().toLatin1()).toInt())!=text){
|
if ( locationToString(object()->property(propertyName().toLatin1()).toInt())!=text){
|
||||||
object()->setProperty(propertyName().toLatin1(),stringToLocation(text));
|
object()->setProperty(propertyName().toLatin1(),stringToLocation(text));
|
||||||
dynamic_cast<ComboBoxEditor*>(sender())->setTextValue(locationToString(object()->property(propertyName().toLatin1()).toInt()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
ObjectBrowser::ObjectBrowser(QWidget *parent)
|
ObjectBrowser::ObjectBrowser(QWidget *parent)
|
||||||
:QWidget(parent), m_report(NULL), m_mainWindow(NULL), m_changingItemSelection(false)
|
:QWidget(parent), m_report(NULL), m_mainWindow(NULL),
|
||||||
|
m_changingItemSelection(false), m_movingItem(false)
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
@ -86,6 +87,7 @@ void ObjectBrowser::slotClear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* reportItem, BaseDesignIntf *ignoredItem){
|
void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* reportItem, BaseDesignIntf *ignoredItem){
|
||||||
|
|
||||||
foreach (BaseDesignIntf* item, reportItem->childBaseItems()) {
|
foreach (BaseDesignIntf* item, reportItem->childBaseItems()) {
|
||||||
if (item != ignoredItem){
|
if (item != ignoredItem){
|
||||||
ObjectBrowserNode* treeItem = new ObjectBrowserNode(parentNode);
|
ObjectBrowserNode* treeItem = new ObjectBrowserNode(parentNode);
|
||||||
@ -93,11 +95,11 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report
|
|||||||
treeItem->setObject(item);
|
treeItem->setObject(item);
|
||||||
treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className())));
|
treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className())));
|
||||||
connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)),
|
connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)),
|
||||||
this, SLOT(slotPropertyObjectNameChanged(QString,QString)));
|
this, SLOT(slotPropertyObjectNameChanged(QString,QString)), Qt::UniqueConnection);
|
||||||
ItemDesignIntf* i = dynamic_cast<ItemDesignIntf*>(item);
|
ItemDesignIntf* i = dynamic_cast<ItemDesignIntf*>(item);
|
||||||
if (i){
|
if (i){
|
||||||
connect(i, SIGNAL(itemLocationChanged(BaseDesignIntf*,BaseDesignIntf*)),
|
connect(i, SIGNAL(itemLocationChanged(BaseDesignIntf*,BaseDesignIntf*)),
|
||||||
this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*)));
|
this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*)), Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
m_itemsMap.insert(item,treeItem);
|
m_itemsMap.insert(item,treeItem);
|
||||||
parentNode->addChild(treeItem);
|
parentNode->addChild(treeItem);
|
||||||
@ -283,7 +285,9 @@ void ObjectBrowser::slotActivePageUpdated(LimeReport::PageDesignIntf *)
|
|||||||
buildTree();
|
buildTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent)
|
|
||||||
|
|
||||||
|
void ObjectBrowser::moveItemNode(BaseDesignIntf* item, BaseDesignIntf* parent)
|
||||||
{
|
{
|
||||||
if (m_itemsMap.contains(item) && m_itemsMap.contains(parent)){
|
if (m_itemsMap.contains(item) && m_itemsMap.contains(parent)){
|
||||||
m_itemsMap.value(item)->parent()->removeChild(m_itemsMap.value(item));
|
m_itemsMap.value(item)->parent()->removeChild(m_itemsMap.value(item));
|
||||||
@ -293,7 +297,24 @@ void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf*
|
|||||||
item->setSelected(true);
|
item->setSelected(true);
|
||||||
m_changingItemSelection = false;
|
m_changingItemSelection = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent)
|
||||||
|
{
|
||||||
|
if (!m_movingItem){
|
||||||
|
m_movingItem = true;
|
||||||
|
moveItemNode(item, parent);
|
||||||
|
m_movingItem = false;
|
||||||
|
foreach(QObject* di, m_defferedItems){
|
||||||
|
BaseDesignIntf* b = dynamic_cast<BaseDesignIntf*>(di);
|
||||||
|
if (b)
|
||||||
|
moveItemNode(b, parent);
|
||||||
|
}
|
||||||
|
m_defferedItems.clear();
|
||||||
|
} else {
|
||||||
|
if (!m_defferedItems.contains(item))
|
||||||
|
m_defferedItems.append(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectBrowserNode::setObject(QObject *value)
|
void ObjectBrowserNode::setObject(QObject *value)
|
||||||
|
@ -60,6 +60,7 @@ protected:
|
|||||||
void buildTree(BaseDesignIntf *ignoredItem = 0);
|
void buildTree(BaseDesignIntf *ignoredItem = 0);
|
||||||
void removeItem(BaseDesignIntf* item);
|
void removeItem(BaseDesignIntf* item);
|
||||||
void findAndRemove(QTreeWidgetItem *node, BaseDesignIntf *item);
|
void findAndRemove(QTreeWidgetItem *node, BaseDesignIntf *item);
|
||||||
|
void moveItemNode(BaseDesignIntf* item, BaseDesignIntf* parent);
|
||||||
private slots:
|
private slots:
|
||||||
// void slotObjectNameChanged(const QString& objectName);
|
// void slotObjectNameChanged(const QString& objectName);
|
||||||
void slotPropertyObjectNameChanged(const QString& oldName, const QString& newName);
|
void slotPropertyObjectNameChanged(const QString& oldName, const QString& newName);
|
||||||
@ -82,6 +83,8 @@ private:
|
|||||||
QTreeWidget* m_treeView;
|
QTreeWidget* m_treeView;
|
||||||
QMap<QObject*, ObjectBrowserNode*> m_itemsMap;
|
QMap<QObject*, ObjectBrowserNode*> m_itemsMap;
|
||||||
bool m_changingItemSelection;
|
bool m_changingItemSelection;
|
||||||
|
bool m_movingItem;
|
||||||
|
QList<QObject*> m_defferedItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
|
Loading…
Reference in New Issue
Block a user