-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
Can we export the tree structure as a figure. #152
Comments
I was facing this problem myself as I was trying to generate nice figures for a paper. It turns out that you can use the QSvgGenerator class for saving an svg view of the tree (https://doc.qt.io/qt-5/qtsvg-svggenerator-example.html). void GraphicContainer::saveSvgFile(const QString path)
{
QSvgGenerator generator;
QRectF rect = _scene->itemsBoundingRect();
generator.setFileName(path);
generator.setSize(QSize(rect.width(), rect.height()));
generator.setViewBox(rect);
QPainter painter;
painter.begin(&generator);
_scene->render(&painter, rect, rect);
} In order to have vector images, we also need to disable the drop shadow and the cache (https://forum.qt.io/topic/6008/how-to-save-a-qgraphicsscene-to-an-svg-file). Notice that we still have some weird additional space after the names, which I haven't figured out yet. Check Affonso-Gui@0ca1350 and Affonso-Gui@be5442d for a working example. |
Thanks for your help! |
So @Affonso-Gui showed how it could be implemented and even demonstrated a working example. This doesn't mean this issue is fully closed now is it? |
Sure, repoened it and wait for more solutions. |
The
|
Oh, and of course the weird additional spacing (different fonts when displaying on canvas vs on the svg image?) |
|
|
Although the command line option does make 1 (and 2) much easier, we could just start the program with save configurations and get the job done. |
Thanks for your great work.
I have a behavior tree with some son node, and want to save the structure as a figure. If i direct screenshot, the image equality is poor. So dose this ui tool provide the save as figure func? I just find the save as xml func. Thanks for your advice.
The text was updated successfully, but these errors were encountered: