Merge pull request #1340 from KLayout/issue-1339

Added a method 'widget' to LayoutView to deliver the QWidget object f…
This commit is contained in:
Matthias Köfferlein 2023-04-16 15:09:28 +02:00 committed by GitHub
commit 5083e6e45e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 5 deletions

View File

@ -28,9 +28,10 @@ jobs:
if: matrix.os == 'ubuntu-latest'
uses: jlumbroso/free-disk-space@main
with:
android: false
dotnet: false
haskell: false
android: true
dotnet: true
haskell: true
large-packages: false # not working currently
- uses: hmarr/debug-action@v2
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.9.1

View File

@ -335,11 +335,17 @@ static void save_image_with_options (lay::LayoutViewBase *view, const std::strin
view->save_image_with_options (fn, width, height, linewidth, oversampling, resolution, tl::Color (), tl::Color (), tl::Color (), target_box, monochrome);
}
#if defined(HAVE_QTBINDINGS)
#if defined(HAVE_QT) && defined(HAVE_QTBINDINGS)
static QImage get_image_with_options (lay::LayoutViewBase *view, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, const db::DBox &target_box, bool monochrome)
{
return view->get_image_with_options (width, height, linewidth, oversampling, resolution, tl::Color (), tl::Color (), tl::Color (), target_box, monochrome);
}
static QWidget *widget (lay::LayoutViewBase *view)
{
return view->widget ();
}
#endif
static std::vector<std::string>
@ -1158,7 +1164,12 @@ LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase ("lay", "LayoutVi
"The image is drawn synchronously with the given width and height. Drawing may take some time. "
"Monochrome images don't have background or annotation objects currently.\n"
"\n"
"This method has been introduced in 0.23.10.\n"
"This method has been introduced in version 0.23.10.\n"
) +
gsi::method_ext ("widget", &widget,
"@brief Gets the QWidget object of the view\n"
"\n"
"This method has been introduced in version 0.28.7.\n"
) +
#endif
gsi::method ("get_screenshot_pixels", static_cast<tl::PixelBuffer (lay::LayoutViewBase::*) ()> (&lay::LayoutViewBase::get_screenshot_pb),

View File

@ -54,6 +54,11 @@
#include "tlDeferredExecution.h"
#include "dbInstElement.h"
#if defined(HAVE_QT)
# include <QImage>
class QWidget;
#endif
namespace rdb {
class Database;
}
@ -980,6 +985,16 @@ public:
*/
tl::BitmapBuffer get_pixels_with_options_mono (unsigned int width, unsigned int height, int linewidth, tl::Color background, tl::Color foreground, tl::Color active_color, const db::DBox &target_box);
#if defined(HAVE_QT)
/**
* @brief Gets the widget object that view is embedded in
*/
virtual QWidget *widget ()
{
return 0;
}
#endif
/**
* @brief Hierarchy level selection setter
*/