View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017654 | Scribus | General | public | 2025-10-18 08:54 | 2025-10-19 09:01 |
Reporter | ale | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | new | Resolution | open | ||
Product Version | 1.7.1.svn | ||||
Summary | 0017654: [PATCH] Repurpose slotDocCh() disabled boolean argument | ||||
Description | ScribusMainWindow::slotDocCh() has an unused "reb" argument that is currently unused. I suggest to rename and repurpose the argument to wasModified = false and allow slotDocCh() to be optimized and avoid doing work that is unnecessary (like updating the window title on each key stroke!) The alternative would be to avoid calling setModfied() before calling slotDocCh(). That would also be fine for me. | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
I have a patch that removes the left overs of the argument. But, sadly, it does not help for avoiding the cascade of updates on each key press in a text frame... This is the path that leads to updating the wndow title: ScribusMainWindow::updateActiveWindowCaption() (/home/ale/src/scribus-gitlab/scribus/scribus.cpp:8670) ScribusMainWindow::slotDocCh() (/home/ale/src/scribus-gitlab/scribus/scribus.cpp:2769) ScribusMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (/home/ale/src/scribus-gitlab/build-gcc/scribus/scribus_autogen/EWIEGA46WW/moc_scribus.cpp:1654) ___lldb_unnamed_symbol15705 (@___lldb_unnamed_symbol15705:392) ScribusDoc::docChanged() (/home/ale/src/scribus-gitlab/build-gcc/scribus/scribus_autogen/EWIEGA46WW/moc_scribusdoc.cpp:1657) ScribusDoc::changed() (/home/ale/src/scribus-gitlab/scribus/scribusdoc.cpp:13531) DocUpdater::changed(PageItem*, bool) (/home/ale/src/scribus-gitlab/scribus/scribusdoc.cpp:181) MassObservable<PageItem*>::updateNow(UpdateMemento*) (/home/ale/src/scribus-gitlab/scribus/observable.h:271) MassObservable<PageItem*>::update(PageItem*) (/home/ale/src/scribus-gitlab/scribus/observable.h:249) SingleObservable<PageItem>::update() (/home/ale/src/scribus-gitlab/scribus/observable.h:176) PageItem_TextFrame::handleModeEditKey(QKeyEvent*, bool&) (/home/ale/src/scribus-gitlab/scribus/pageitem_textframe.cpp:4405) CanvasMode_Edit::keyPressEvent(QKeyEvent*) (/home/ale/src/scribus-gitlab/scribus/canvasmode_edit.cpp:129) ... If I got it right, -- and just as an example -- when the Outline palette is open, each item of the outline palette is recreated for each key press in a text frame... I guess it's worth to audit what kind of updates are needed on each key press... |
|
here is a patch removing the argument from the slotDocCh() slot-doc-ch.diff (5,790 bytes)
From 2b453c13cc4614ee2dab0717e285f4c3884a28fd Mon Sep 17 00:00:00 2001 From: ale rimoldi <ale@graphicslab.org> Date: Sun, 19 Oct 2025 11:00:22 +0200 Subject: remove the unused argument from slotDocCh diff --git a/scribus/canvasmode_edit.cpp b/scribus/canvasmode_edit.cpp index bcaf4044c..d53ea891b 100644 --- a/scribus/canvasmode_edit.cpp +++ b/scribus/canvasmode_edit.cpp @@ -124,7 +124,7 @@ void CanvasMode_Edit::keyPressEvent(QKeyEvent *e) } blinkTextCursor(); if (!currItem->isTextFrame() || (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty())) - m_ScMW->slotDocCh(false); + m_ScMW->slotDocCh(); currItem->handleModeEditKey(e, m_keyRepeat); if (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty()) { diff --git a/scribus/plugins/scriptplugin/cmdobj.cpp b/scribus/plugins/scriptplugin/cmdobj.cpp index 30b38c627..219446b00 100644 --- a/scribus/plugins/scriptplugin/cmdobj.cpp +++ b/scribus/plugins/scriptplugin/cmdobj.cpp @@ -575,7 +575,7 @@ PyObject *scribus_settextflowmode(PyObject* /* self */, PyObject* args) else if (state == (int) PageItem::TextFlowUsesContourLine ) i->setTextFlowMode(PageItem::TextFlowUsesContourLine); ScCore->primaryMainWindow()->view->DrawNew(); - ScCore->primaryMainWindow()->slotDocCh(true); + ScCore->primaryMainWindow()->slotDocCh(); Py_RETURN_NONE; } diff --git a/scribus/plugins/scriptplugin/guiapp.cpp b/scribus/plugins/scriptplugin/guiapp.cpp index 1ee511c7f..161d6d3ec 100644 --- a/scribus/plugins/scriptplugin/guiapp.cpp +++ b/scribus/plugins/scriptplugin/guiapp.cpp @@ -73,17 +73,9 @@ PyObject *scribus_setcursor(PyObject* /* self */, PyObject* args) PyObject *scribus_docchanged(PyObject* /* self */, PyObject* args) { - int aValue; - if (!PyArg_ParseTuple(args, "i", &aValue)) - return nullptr; if (!checkHaveDocument()) return nullptr; - ScCore->primaryMainWindow()->slotDocCh(static_cast<bool>(aValue)); - /* - if (aValue>0) - ScCore->primaryMainWindow()->slotDocCh(true); - else - ScCore->primaryMainWindow()->slotDocCh(false);*/ + ScCore->primaryMainWindow()->slotDocCh(); Py_RETURN_NONE; } diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp index c1457a882..f9e4441ef 100644 --- a/scribus/scribus.cpp +++ b/scribus/scribus.cpp @@ -2595,7 +2595,7 @@ void ScribusMainWindow::SwitchWin() else { if (doc->isModified()) - slotDocCh(false); + slotDocCh(); pagePalette->enablePalette(true); setPreviewToolbar(); } @@ -2639,7 +2639,7 @@ void ScribusMainWindow::HaveNewDoc() connect(view, SIGNAL(layerChanged(int)), layerPalette, SLOT(markActiveLayer(int)), Qt::UniqueConnection); connect(this, SIGNAL(changeLayers(int)), layerPalette, SLOT(markActiveLayer(int)), Qt::UniqueConnection); connect(view->horizRuler, SIGNAL(MarkerMoved(double,double)), this, SLOT(setStatusBarTextPosition(double,double)), Qt::UniqueConnection); - connect(view->horizRuler, SIGNAL(DocChanged(bool)), this, SLOT(slotDocCh(bool)), Qt::UniqueConnection); + connect(view->horizRuler, SIGNAL(DocChanged(bool)), this, SLOT(slotDocCh()), Qt::UniqueConnection); connect(view, SIGNAL(ClipPo(double,double)), nodePalette, SLOT(SetXY(double,double)), Qt::UniqueConnection); connect(view, SIGNAL(PolyOpen()), nodePalette, SLOT(IsOpen()), Qt::UniqueConnection); connect(view, SIGNAL(ItemGeom()), propertiesPalette->xyzPal, SLOT(handleSelectionChanged()), Qt::UniqueConnection); @@ -2752,7 +2752,7 @@ void ScribusMainWindow::HaveNewSel() appModeHelper->updateActionPluginsActions(doc); } -void ScribusMainWindow::slotDocCh(bool /*reb*/) +void ScribusMainWindow::slotDocCh() { if (!doc->isModified()) doc->setModified(true); @@ -3000,7 +3000,7 @@ void ScribusMainWindow::doPasteRecent(const QString& data) if (pasteAction) pasteAction.commit(); } - slotDocCh(false); + slotDocCh(); slotPreviewCh(); doc->regionsChanged()->update(QRectF()); view->dragX = 0; @@ -4866,7 +4866,7 @@ void ScribusMainWindow::slotEditPaste(bool forcePlainText) inlinePalette->setDoc(doc); view->DrawNew(); - slotDocCh(false); + slotDocCh(); slotPreviewCh(); } @@ -7470,9 +7470,9 @@ void ScribusMainWindow::slotChangeUnit(int unitIndex, bool draw) void ScribusMainWindow::ManageJava() { JavaDocs *dia = new JavaDocs(this, doc, view); - connect(dia, SIGNAL(docChanged(bool)), this, SLOT(slotDocCh(bool))); + connect(dia, SIGNAL(docChanged(bool)), this, SLOT(slotDocCh())); dia->exec(); - disconnect(dia, SIGNAL(docChanged(bool)), this, SLOT(slotDocCh(bool))); + disconnect(dia, SIGNAL(docChanged(bool)), this, SLOT(slotDocCh())); delete dia; } @@ -8677,7 +8677,7 @@ void ScribusMainWindow::dropEvent ( QDropEvent * e) HaveNewDoc(); doc->reformPages(true); slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view); - slotDocCh(false); + slotDocCh(); doc->regionsChanged()->update(QRectF()); } } @@ -8715,7 +8715,7 @@ void ScribusMainWindow::dropEvent ( QDropEvent * e) HaveNewDoc(); doc->reformPages(true); slotElemRead(text, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view); - slotDocCh(false); + slotDocCh(); doc->regionsChanged()->update(QRectF()); } accepted = true; diff --git a/scribus/scribus.h b/scribus/scribus.h index 7b2a7185b..e9c2dc5eb 100644 --- a/scribus/scribus.h +++ b/scribus/scribus.h @@ -478,8 +478,8 @@ public slots: /** \brief Neues Dokument erzeugt */ void HaveNewDoc(); void HaveNewSel(); - /** Dokument ist geaendert worden */ - void slotDocCh(bool reb = true); + /** The document has been changed */ + void slotDocCh(); /** Page preview changed */ void slotPreviewCh(); /** Setzt die Abstufung */ |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-10-18 08:54 | ale | New Issue | |
2025-10-18 20:15 | ale | Note Added: 0053076 | |
2025-10-18 20:16 | ale | Note Edited: 0053076 | |
2025-10-18 20:16 | ale | Note Edited: 0053076 | |
2025-10-19 09:01 | ale | Note Added: 0053078 | |
2025-10-19 09:01 | ale | File Added: slot-doc-ch.diff | |
2025-10-19 09:01 | ale | Summary | Repurpose slotDocCh() disabled boolean argument => [PATCH] Repurpose slotDocCh() disabled boolean argument |
2025-10-19 09:01 | ale | Patch | No => Yes |