mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-01 15:24:13 +02:00
Place a template under the cursor, and list it as soon as it is saved
A template (.qetmak) was previewed and placed offset from the cursor by the position its items had on the folio it was saved from: the preview pixmap kept that offset, and addMacro() added it back before handing the position to fromXml(). A template saved from the middle or the lower right of a folio therefore landed far below and to the right of the click, often off the folio, which reads as "the template does not drop" (forum topic 3190). Anchor both the preview and the placement on the template's own top-left corner instead. fromXml() skips translating for a null position, so a click on the folio origin is nudged by a fraction of a pixel that the grid snap removes. Also: - a template saved with "Create a template" only appeared in the templates tab after reloading the collections or restarting; it is now added to the tab of every open editor when it is saved; - the placement status bar message ended in an untranslated "(Makro-Anker)"; it now reads "x : y" like element placement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -172,6 +172,18 @@ void ElementsCollectionWidget::setCurrentLocation(
|
||||
m_model->indexFromLocation(location));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::addTemplate
|
||||
Show a newly saved template in the templates tab, which is otherwise
|
||||
only read when the collections are loaded or reloaded.
|
||||
@param location : the saved .qetmak file
|
||||
*/
|
||||
void ElementsCollectionWidget::addTemplate(const ElementsLocation &location)
|
||||
{
|
||||
if (m_macros_model && location.exist())
|
||||
m_macros_model->addLocation(location);
|
||||
}
|
||||
|
||||
void ElementsCollectionWidget::leaveEvent(QEvent *event)
|
||||
{
|
||||
if (QETDiagramEditor *qde = QETApp::diagramEditorAncestorOf(this))
|
||||
|
||||
Reference in New Issue
Block a user