Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action on double click layout item #59566

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

YoannQDQ
Copy link
Contributor

Description

Add QgsLayoutItemAbstractGuiMetadata::handleDoubleClick to define an action that will be called when a layout item is double clicked.

This new method takes two arguments : a QgsLayoutItem, and a Qgis::MouseHandlesAction (new enum that replaces QgsGraphicsViewMouseHandles::MouseAction), which allow to define custom behavior if a specific mouse handle is doublecliked (could be used to resize a QgsLayoutItemLabel to fit the current text for instance).

As an example, this PR fixes #46462.

@YoannQDQ YoannQDQ added Feature Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks labels Nov 22, 2024
@github-actions github-actions bot added this to the 3.42.0 milestone Nov 22, 2024
Copy link

github-actions bot commented Nov 22, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 84d72cc)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 84d72cc)

src/gui/layout/qgslayoutmanualtablewidget.cpp Outdated Show resolved Hide resolved
src/gui/layout/qgslayoutmousehandles.cpp Show resolved Hide resolved
src/gui/layout/qgslayoutmousehandles.cpp Show resolved Hide resolved
*
* \since QGIS 3.42
*/
enum class MouseHandlesAction : int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to add the python compatibility code to this (ie SIP_MONKEYPATCH_SCOPEENUM_UNNEST), to maintain existing API.

See eg

enum class FeatureCountState SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsVectorDataProvider, FeatureCountState ) : int

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary? QgsGraphicsViewMouseHandles is not part of the PyQGIS API

@nyalldawson
Copy link
Collaborator

Nice work, this is a great API feature to have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Double click fixed table should open the 'Edit Table' dialog
2 participants