tdf#130857 qt weld: Implement QtInstanceWidget::get_extents_relative_to
This e.g. gets called when pressing the "Find Next" button in the "Find and Replace" dialog. Change-Id: I30e33d52d19b0afe44564486bfa79e3b500ae856 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177832 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
parent
5614c39745
commit
44b2a3d536
2 changed files with 22 additions and 4 deletions
|
@ -130,7 +130,8 @@ public:
|
|||
|
||||
virtual void grab_remove() override;
|
||||
|
||||
virtual bool get_extents_relative_to(const Widget&, int&, int&, int&, int&) const override;
|
||||
virtual bool get_extents_relative_to(const Widget& rRelative, int& rX, int& rY, int& rWidth,
|
||||
int& rHeight) const override;
|
||||
|
||||
virtual bool get_direction() const override;
|
||||
|
||||
|
|
|
@ -459,10 +459,27 @@ bool QtInstanceWidget::has_grab() const
|
|||
|
||||
void QtInstanceWidget::grab_remove() { assert(false && "Not implemented yet"); }
|
||||
|
||||
bool QtInstanceWidget::get_extents_relative_to(const Widget&, int&, int&, int&, int&) const
|
||||
bool QtInstanceWidget::get_extents_relative_to(const Widget& rRelative, int& rX, int& rY,
|
||||
int& rWidth, int& rHeight) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return false;
|
||||
SolarMutexGuard g;
|
||||
|
||||
bool bRet = false;
|
||||
GetQtInstance().RunInMainThread([&] {
|
||||
QRect aGeometry = m_pWidget->geometry();
|
||||
rWidth = aGeometry.width();
|
||||
rHeight = aGeometry.height();
|
||||
const QtInstanceWidget* pRelativeWidget = dynamic_cast<const QtInstanceWidget*>(&rRelative);
|
||||
if (!pRelativeWidget)
|
||||
return;
|
||||
|
||||
QPoint aRelativePos = m_pWidget->mapTo(pRelativeWidget->getQWidget(), QPoint(0, 0));
|
||||
rX = aRelativePos.x();
|
||||
rY = aRelativePos.y();
|
||||
bRet = true;
|
||||
});
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool QtInstanceWidget::get_direction() const
|
||||
|
|
Loading…
Reference in a new issue