|
|
|
|
@@ -1643,7 +1643,6 @@ void TreeWidget::mouseDoubleClickEvent(QMouseEvent* event)
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (item->type() == TreeWidget::DocumentType) {
|
|
|
|
|
//QTreeWidget::mouseDoubleClickEvent(event);
|
|
|
|
|
Gui::Document* doc = static_cast<DocumentItem*>(item)->document();
|
|
|
|
|
if (!doc)
|
|
|
|
|
return;
|
|
|
|
|
@@ -2691,19 +2690,6 @@ void TreeWidget::sortDroppedObjects(TargetItemInfo& targetInfo, std::vector<App:
|
|
|
|
|
void TreeWidget::drawRow(QPainter* painter, const QStyleOptionViewItem& options, const QModelIndex& index) const
|
|
|
|
|
{
|
|
|
|
|
QTreeWidget::drawRow(painter, options, index);
|
|
|
|
|
// Set the text and highlighted text color of a hidden object to a dark
|
|
|
|
|
//QTreeWidgetItem * item = itemFromIndex(index);
|
|
|
|
|
//if (item->type() == ObjectType && !(static_cast<DocumentObjectItem*>(item)->previousStatus & 1)) {
|
|
|
|
|
// QStyleOptionViewItem opt(options);
|
|
|
|
|
// opt.state ^= QStyle::State_Enabled;
|
|
|
|
|
// QColor c = opt.palette.color(QPalette::Inactive, QPalette::Dark);
|
|
|
|
|
// opt.palette.setColor(QPalette::Inactive, QPalette::Text, c);
|
|
|
|
|
// opt.palette.setColor(QPalette::Inactive, QPalette::HighlightedText, c);
|
|
|
|
|
// QTreeWidget::drawRow(painter, opt, index);
|
|
|
|
|
//}
|
|
|
|
|
//else {
|
|
|
|
|
// QTreeWidget::drawRow(painter, options, index);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TreeWidget::slotNewDocument(const Gui::Document& Doc, bool isMainDoc)
|
|
|
|
|
@@ -2718,16 +2704,6 @@ void TreeWidget::slotNewDocument(const Gui::Document& Doc, bool isMainDoc)
|
|
|
|
|
DocumentMap[&Doc] = item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TreeWidget::slotStartOpenDocument() {
|
|
|
|
|
// No longer required. Visibility is now handled inside onUpdateStatus() by
|
|
|
|
|
// UpdateDisabler.
|
|
|
|
|
//
|
|
|
|
|
// setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TreeWidget::slotFinishOpenDocument() {
|
|
|
|
|
// setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TreeWidget::onReloadDoc() {
|
|
|
|
|
if (!this->contextItem || this->contextItem->type() != DocumentType)
|
|
|
|
|
@@ -2842,11 +2818,11 @@ struct UpdateDisabler {
|
|
|
|
|
focus = widget.hasFocus();
|
|
|
|
|
visible = widget.isVisible();
|
|
|
|
|
if (visible) {
|
|
|
|
|
// setUpdatesEnabled(false) does not seem to speed up anything.
|
|
|
|
|
// setVisible(false) on the other hand makes QTreeWidget::setData
|
|
|
|
|
// (i.e. any change to QTreeWidgetItem) faster by 10+ times.
|
|
|
|
|
//
|
|
|
|
|
// widget.setUpdatesEnabled(false);
|
|
|
|
|
// setUpdatesEnabled(false) does not seem to speed up anything.
|
|
|
|
|
// setVisible(false) on the other hand makes QTreeWidget::setData
|
|
|
|
|
// (i.e. any change to QTreeWidgetItem) faster by 10+ times.
|
|
|
|
|
//
|
|
|
|
|
// widget.setUpdatesEnabled(false);
|
|
|
|
|
|
|
|
|
|
widget.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
@@ -2857,7 +2833,6 @@ struct UpdateDisabler {
|
|
|
|
|
|
|
|
|
|
if (visible) {
|
|
|
|
|
widget.setVisible(true);
|
|
|
|
|
// widget.setUpdatesEnabled(true);
|
|
|
|
|
if (focus)
|
|
|
|
|
widget.setFocus();
|
|
|
|
|
}
|
|
|
|
|
@@ -4544,21 +4519,6 @@ Gui::Document* DocumentItem::document() const
|
|
|
|
|
return this->pDocument;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//void DocumentItem::markItem(const App::DocumentObject* Obj,bool mark)
|
|
|
|
|
//{
|
|
|
|
|
// // never call without Object!
|
|
|
|
|
// assert(Obj);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// std::map<std::string,DocumentObjectItem*>::iterator pos;
|
|
|
|
|
// pos = ObjectMap.find(Obj);
|
|
|
|
|
// if (pos != ObjectMap.end()) {
|
|
|
|
|
// QFont f = pos->second->font(0);
|
|
|
|
|
// f.setUnderline(mark);
|
|
|
|
|
// pos->second->setFont(0,f);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
void DocumentItem::testStatus()
|
|
|
|
|
{
|
|
|
|
|
for (const auto& v : ObjectMap)
|
|
|
|
|
@@ -4670,33 +4630,8 @@ void DocumentItem::updateItemSelection(DocumentObjectItem* item)
|
|
|
|
|
if (!subname.empty()) {
|
|
|
|
|
auto parentItem = item->getParentItem();
|
|
|
|
|
assert(parentItem);
|
|
|
|
|
if (selected && parentItem->selected) {
|
|
|
|
|
// When a group item is selected, all its children objects are
|
|
|
|
|
// highlighted in the 3D view. So, when an item of some group is
|
|
|
|
|
// newly selected, we must force unselect its parent in order to
|
|
|
|
|
// show the selection highlight. Besides, select both the parent
|
|
|
|
|
// group and its children doesn't make much sense.
|
|
|
|
|
//
|
|
|
|
|
// UPDATE: There are legit use case of both parent and child
|
|
|
|
|
// selection, for example, to disambiguate under which group to
|
|
|
|
|
// operate on the child.
|
|
|
|
|
//
|
|
|
|
|
// TREE_TRACE("force unselect parent");
|
|
|
|
|
// parentItem->setSelected(false);
|
|
|
|
|
// updateItemSelection(parentItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selected && item->isGroup()) {
|
|
|
|
|
// Same reasoning as above. When a group item is newly selected, We
|
|
|
|
|
// choose to force unselect all its children to void messing up the
|
|
|
|
|
// selection highlight
|
|
|
|
|
//
|
|
|
|
|
// UPDATE: same as above, child and parent selection is now re-enabled.
|
|
|
|
|
//
|
|
|
|
|
// TREE_TRACE("force unselect all children");
|
|
|
|
|
// updateSelection(item,true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!selected) {
|
|
|
|
|
Gui::Selection().rmvSelection(docname, objname, subname.c_str());
|
|
|
|
|
|