Skip to content

Commit

Permalink
[gui] code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
mosfet80 committed May 20, 2024
1 parent 1eac717 commit ad93174
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 75 deletions.
2 changes: 1 addition & 1 deletion src/Gui/CommandStd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ StdCmdReloadStyleSheet::StdCmdReloadStyleSheet()
sWhatsThis = "Std_ReloadStyleSheet";
}

void StdCmdReloadStyleSheet::activated(int iMsg)
void StdCmdReloadStyleSheet::activated(int )
{
auto mw = getMainWindow();

Expand Down
1 change: 0 additions & 1 deletion src/Gui/DlgActionsImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ IconDialog::IconDialog(QWidget* parent)
QStringList names = BitmapFactory().findIconFiles();
for (const auto & name : names) {
item = new QListWidgetItem(ui->listWidget);
//item->setIcon(QIcon(*it));
item->setIcon(QIcon(BitmapFactory().pixmap((const char*)name.toUtf8())));
item->setText(QFileInfo(name).baseName());
item->setToolTip(name);
Expand Down
3 changes: 0 additions & 3 deletions src/Gui/DownloadItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,6 @@ void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)

void DownloadItem::updateInfoLabel()
{
//if (m_reply->error() == QNetworkReply::NoError)
// return;

qint64 bytesTotal = progressBar->maximum();
bool running = !downloadedSuccessfully();

Expand Down
70 changes: 0 additions & 70 deletions src/Gui/Tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -2842,12 +2818,6 @@ 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);

widget.setVisible(false);
}
}
Expand Down Expand Up @@ -4544,21 +4514,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)
Expand Down Expand Up @@ -4670,33 +4625,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());
Expand Down

0 comments on commit ad93174

Please sign in to comment.