-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add basic drag and drop support in the model designer #60664
base: master
Are you sure you want to change the base?
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! 👍
Please let me know when you have finished this work and the PR is not draft anymore, I would make a proper review.
// painter->restore(); | ||
} | ||
|
||
void QgsModelDesignerSocketGraphicItem::mousePressEvent( QGraphicsSceneMouseEvent *event ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to override it if you don't mean to change anything
|
||
void QgsModelDesignerSocketGraphicItem::modelPressEvent( QgsModelViewMouseEvent *event ) | ||
{ | ||
QgsModelDesignerFlatButtonGraphicItem::modelPressEvent( event ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
|
||
painter->setRenderHint( QPainter::Antialiasing ); | ||
|
||
float display_size = 3.2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a static constant ?
if ( mHoverState ) | ||
{ | ||
painter->setPen( QPen() ); | ||
painter->setBrush( QBrush( QColor( 0, 0, 0, 200 ), Qt::SolidPattern ) ); | ||
} | ||
else | ||
{ | ||
painter->setPen( QPen() ); | ||
painter->setBrush( QBrush( QColor( 0, 0, 0, 33 ), Qt::SolidPattern ) ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( mHoverState ) | |
{ | |
painter->setPen( QPen() ); | |
painter->setBrush( QBrush( QColor( 0, 0, 0, 200 ), Qt::SolidPattern ) ); | |
} | |
else | |
{ | |
painter->setPen( QPen() ); | |
painter->setBrush( QBrush( QColor( 0, 0, 0, 33 ), Qt::SolidPattern ) ); | |
} | |
painter->setPen( QPen() ); | |
painter->setBrush( QBrush( QColor( 0, 0, 0, mHoverState ? 200 : 33 ), Qt::SolidPattern ) ); |
/** | ||
* Gets the button's position. | ||
*/ | ||
const QPointF getPosition() { return mPosition; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const QPointF getPosition() { return mPosition; }; | |
QPointF getPosition() { return mPosition; }; |
@@ -91,12 +98,12 @@ class GUI_EXPORT QgsModelDesignerFlatButtonGraphicItem : public QGraphicsObject | |||
* Sets the \a picture to render for the button graphics. | |||
*/ | |||
void setPicture( const QPicture &picture ); | |||
bool mHoverState = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why public?
This is great! 🥳 I haven't done a code review yet, but just a couple of quick thoughts based on the screencasts:
|
for more information, see https://pre-commit.ci
Introduction
This PR add the new way to edit a model using a drag and drop interface. This is part of long waited improvements in the model designer capabilities.
The design is based of the Google Summer of code proposal I did last year, and that we discussed on the mailling list. Compared to the original proposal the UI looks more similar to the current modeler interface
I encourage anyone to open your existing models and give it a try !
Thanks to the Hauts-de-France region for sponsorising this work
How does it works ?
New sockets were added around each parameter and algorithm used in a model.
sockets.example.mp4
Those are interactive and are used to connect component between them. To connect component drag any output socket regardless of it's from a model parameter or a algorithm into an input socket. You can also remove a connection by dragging an edge out of the socket.
peek.drag.and.drop.mp4
Theses new capabilities have been added as part of the select/edit tool. No needs to switch to a new tool when you want to edit connection in your model. The icon has been updated in consequence.
This PR remain fully compatible with the previous user interface. When you connect sockets by drag and drop. The dialog used when opening an algorithm is updated as well.
retro.compatible.mp4