include/vcl/qt/QtUtils.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit e3ef8372d330a05fe485792edc99e139c847ae45 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 11 23:51:53 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Apr 12 09:10:43 2025 +0200 tdf#130857 qt weld: Pass logic size to OutputDevice::GetBitmapEx In a local experimental/WIP branch where support for the spelling dialog ("Tools" -> "Spelling") and the Base "Tools" -> "SQL" dialog are declared in QtInstanceBuilder, the text in their edit views wasn't displayed properly, but only a very small percentage of the text was displayed in the QLabel of the QtInstanceDrawingArea and it looked cropped, despite the QLabel widget itself being large enough to hold the full content (i.e. much of its area remained unused instead of showing the edit view/text). According to my analysis, this is because OutputDevice::GetBitmapEx expects logic coordinates, while the toQPixmap helper function was passing pixel coordinates so far. Inside OutputDevice::GetBitmap the width/height would then be converted from alleged logic size to device pixels: Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const { if ( !mpGraphics && !AcquireGraphics() ) return Bitmap(); assert(mpGraphics); tools::Long nX = ImplLogicXToDevicePixel( rSrcPt.X() ); tools::Long nY = ImplLogicYToDevicePixel( rSrcPt.Y() ); -> tools::Long nWidth = ImplLogicWidthToDevicePixel( rSize.Width() ); -> tools::Long nHeight = ImplLogicHeightToDevicePixel( rSize.Height() ); , resulting in a way too small width and height being used. Fix the issue by passing the device's logic instead of pixel size. Other images/drawing areas in already supported dialogs still looked fine in a quick test. Sample backtrace of how the relevant code got called for the Base "SQL" dialog: 1 OutputDevice::GetBitmap bitmap.cxx 198 0x7f68a668cbeb 2 OutputDevice::GetBitmapEx bitmapex.cxx 154 0x7f68a6692cbf 3 toQPixmap QtUtils.hxx 65 0x7f689e21752d 4 QtInstanceDrawingArea::handlePaintEvent QtInstanceDrawingArea.cxx 125 0x7f689e22d304 5 QtInstanceDrawingArea::eventFilter QtInstanceDrawingArea.cxx 104 0x7f689e22d0fe 6 QCoreApplicationPrivate::sendThroughObjectEventFilters qcoreapplication.cpp 1248 0x7f689d24f65d 7 QApplicationPrivate::notify_helper qapplication.cpp 3303 0x7f689b1e2e7e 8 QApplication::notify qapplication.cpp 3255 0x7f689b1e6d84 9 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1111 0x7f689d24f159 10 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1565 0x7f689d24fe59 11 QWidgetPrivate::sendPaintEvent qwidget.cpp 5659 0x7f689b297bbf 12 QWidgetPrivate::drawWidget qwidget.cpp 5609 0x7f689b28ccb5 13 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5788 0x7f689b298140 14 QWidgetPrivate::drawWidget qwidget.cpp 5650 0x7f689b28d0b7 15 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5788 0x7f689b298140 16 QWidgetPrivate::drawWidget qwidget.cpp 5650 0x7f689b28d0b7 17 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5788 0x7f689b298140 18 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 19 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 20 QWidgetPrivate::drawWidget qwidget.cpp 5650 0x7f689b28d0b7 21 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5788 0x7f689b298140 22 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 23 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 24 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 25 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 26 QWidgetPrivate::drawWidget qwidget.cpp 5650 0x7f689b28d0b7 27 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5788 0x7f689b298140 28 QWidgetPrivate::drawWidget qwidget.cpp 5650 0x7f689b28d0b7 29 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5788 0x7f689b298140 30 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 31 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5774 0x7f689b297fe0 32 QWidgetPrivate::drawWidget qwidget.cpp 5650 0x7f689b28d0b7 33 QWidgetRepaintManager::paintAndFlush qwidgetrepaintmanager.cpp 907 0x7f689b2d41d2 34 QWidgetRepaintManager::sync qwidgetrepaintmanager.cpp 632 0x7f689b2d21d7 35 QWidgetPrivate::syncBackingStore qwidget.cpp 1775 0x7f689b28b9bb 36 QWidgetWindow::handleExposeEvent qwidgetwindow.cpp 1100 0x7f689b2e3910 37 QWidgetWindow::event qwidgetwindow.cpp 339 0x7f689b2e0c73 38 QApplicationPrivate::notify_helper qapplication.cpp 3309 0x7f689b1e2ea0 39 QApplication::notify qapplication.cpp 3259 0x7f689b1e6da8 40 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1111 0x7f689d24f159 41 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1565 0x7f689d24fe59 42 QGuiApplicationPrivate::processExposeEvent qguiapplication.cpp 3482 0x7f689c091814 43 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 2276 0x7f689c08cb54 44 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 1113 0x7f689c174c6d 45 QWindowSystemInterface::flushWindowSystemEvents qwindowsysteminterface.cpp 1082 0x7f689c174b1e 46 QtWaylandClient::QWaylandDisplay::flushRequests qwaylanddisplay.cpp 521 0x7f68972afd75 47 QtWaylandClient::QWaylandDisplay::qt_static_metacall moc_qwaylanddisplay_p.cpp 94 0x7f68972b4cdf 48 doActivate<false> qobject.cpp 4253 0x7f689d328654 49 QMetaObject::activate qobject.cpp 4301 0x7f689d31e763 50 QAbstractEventDispatcher::awake moc_qabstracteventdispatcher.cpp 128 0x7f689d2386b9 51 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 406 0x7f689d852db8 52 QPAEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 89 0x7f689c986d88 53 QEventLoop::processEvents qeventloop.cpp 104 0x7f689d2692e0 54 QEventLoop::exec qeventloop.cpp 186 0x7f689d269533 55 QDialog::exec qdialog.cpp 575 0x7f689b68e580 56 QtInstanceDialog::run QtInstanceDialog.cxx 105 0x7f689e227994 57 weld::DialogController::run weld.hxx 2814 0x7f683ca5262e 58 svt::OGenericUnoDialog::execute genericunodialog.cxx 206 0x7f68a8a83d6c 59 dbaui::OApplicationController::openDialog AppControllerGen.cxx 202 0x7f683ca5eb89 60 dbaui::OApplicationController::Execute AppController.cxx 1305 0x7f683ca09f84 61 dbaui::OGenericUnoController::executeChecked genericcontroller.cxx 974 0x7f683cb60803 62 dbaui::OGenericUnoController::dispatch genericcontroller.cxx 586 0x7f683cb5d66a 63 framework::MenuBarManager::Select menubarmanager.cxx 821 0x7f68acf0f08b 64 framework::MenuBarManager::LinkStubSelect menubarmanager.cxx 776 0x7f68acf0eafd 65 Link<Menu *, bool>::Call link.hxx 105 0x7f68a637ced6 66 Menu::Select menu.cxx 352 0x7f68a636ec13 [...] Change-Id: Ibb0904be6333f85fc5c809b549d48681e1339e0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184083 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/qt/QtUtils.hxx b/include/vcl/qt/QtUtils.hxx index 3ab5f19f02cb..65fb645d0e2a 100644 --- a/include/vcl/qt/QtUtils.hxx +++ b/include/vcl/qt/QtUtils.hxx @@ -62,7 +62,7 @@ inline QPixmap toQPixmap(const css::uno::Reference<css::graphic::XGraphic>& rIma inline QPixmap toQPixmap(const OutputDevice& rDevice) { - return toQPixmap(Image(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSizePixel()))); + return toQPixmap(Image(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSize()))); } inline QPixmap loadQPixmapIcon(const OUString& rIconName)