Merge branch 'qt-richtooltip-fixes' of https://github.com/AliKet/wxWidgets

wxRichToolTip fixes for wxQt port.

See #24170.
This commit is contained in:
Vadim Zeitlin 2023-12-31 17:48:37 +01:00
commit 927590fbcd
4 changed files with 29 additions and 13 deletions

View file

@ -62,8 +62,8 @@ public:
resized using SetSize().
As the overload above, this method is not guaranteed to work on all
platforms but currently does work in wxMSW, wxOSX/Cocoa and wxGTK (with
the appropriate but almost always present X11 extensions) ports.
platforms but currently does work in wxMSW, wxOSX/Cocoa, wxGTK (with
the appropriate but almost always present X11 extensions) and wxQt ports.
@since 2.9.3
*/

View file

@ -431,8 +431,8 @@ bool wxPopupTransientWindow::Show( bool show )
void wxPopupTransientWindow::Dismiss()
{
Hide();
PopHandlers();
Hide();
}
#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON

View file

@ -18,12 +18,12 @@
#ifndef WX_PRECOMP
#include "wx/dcclient.h"
#include "wx/region.h"
#include "wx/dcmemory.h"
#include "wx/region.h"
#endif // WX_PRECOMP
#include "wx/nonownedwnd.h"
#include "wx/graphics.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/utils.h"
@ -57,10 +57,27 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region)
}
#if wxUSE_GRAPHICS_CONTEXT
bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& WXUNUSED(path))
bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path)
{
wxMISSING_IMPLEMENTATION( __FUNCTION__ );
return true;
// Convert the path to wxRegion by rendering the path on a window-sized
// bitmap, creating a mask from it and finally creating the region from
// this mask.
wxBitmap bmp(GetSize());
{
wxMemoryDC dc(bmp);
dc.SetBackground(*wxBLACK_BRUSH);
dc.Clear();
std::unique_ptr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
context->SetBrush(*wxWHITE_BRUSH);
context->SetAntialiasMode(wxANTIALIAS_NONE);
context->FillPath(path);
}
bmp.SetMask(new wxMask(bmp, *wxBLACK));
return DoSetRegionShape(wxRegion(bmp));
}
#endif

View file

@ -42,9 +42,9 @@ wxPopupWindow::wxPopupWindow(wxWindow *parent, int flags)
Create(parent, flags);
}
bool wxPopupWindow::Create( wxWindow *WXUNUSED(parent), int style )
bool wxPopupWindow::Create( wxWindow *parent, int style )
{
m_qtWindow = new wxQtPopupWindow(nullptr, this);
m_qtWindow = new wxQtPopupWindow(parent, this);
m_qtWindow->setWindowFlag(Qt::Popup);
m_qtWindow->setFocusPolicy(Qt::NoFocus);
@ -55,7 +55,6 @@ bool wxPopupWindow::Create( wxWindow *WXUNUSED(parent), int style )
// Unlike windows, top level windows are created hidden by default.
m_isShown = false;
// Under wxQt, popups should be created without parent. Otherwise, the
// application would crash (caused by double deletion) when it's shut down.
return wxPopupWindowBase::Create( nullptr, style );
return wxPopupWindowBase::Create(parent, style) &&
wxWindow::Create( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
}