Skip to content

Conversation

soramanew
Copy link

@soramanew soramanew commented Jul 22, 2025

Adds a custom QML component ItemImageGrab which can be used to grab and save items to an image file. The component provides 2 methods each with 2 overloads, grab and cropAndGrab.

grab is for grabbing and saving an item to a file asynchronously, while cropAndGrab does the same but allows cropping to a specific size when saving.

Copy link
Member

@outfoxxed outfoxxed left a comment

Choose a reason for hiding this comment

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

In general I prefer asynchronous operations like this to be done via QML elements.

In this case something like

ItemImageGrab {
  function grab(item: Item, path: url, imageSize: size);
  function grab(item: Item, path: url); // calls prev with image size
  signal saved();
  signal failed();
}

Really this is better suited to promises, whenever those get done.

@soramanew
Copy link
Author

Unfortunately, I have no idea how to make a custom qml object 😭

I'll try work on this in a few days I guess

Create ItemImageGrab qml component
@soramanew soramanew requested a review from outfoxxed July 31, 2025 12:46
Copy link
Member

@outfoxxed outfoxxed left a comment

Choose a reason for hiding this comment

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

also format

@soramanew
Copy link
Author

also format

Yeah sorry, forgot about that lol

@soramanew soramanew requested a review from outfoxxed August 2, 2025 05:35
@soramanew soramanew changed the title core/qmlglobal: add saveToFile core/itemimagegrab: ItemImageGrab component Aug 6, 2025
@soramanew
Copy link
Author

.w.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants