C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::polyhandle (Draft Paper Attached)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 10 Jun 2025 10:54:25 -0500
On Tuesday, 10 June 2025 04:30:26 Central Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> It would be good if I could, at runtime, check if it's a QWindow or a
> wxWindow:
>
> for ( polyhandle p : g_all_windows )
> {
> if ( p.dynamicCast<QWindow> ) DoSomething();
> else if ( p.dynamicCast<wxWidget> ) DoSomethingElse();
> }

You don't need that. You can do:

   for (QWindow *window : QGuiApplication::topLevelWindows())
        doSomething(window);
    wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
    while (node)
    {
        wxWindow* win = node->GetData();
        DoSomethingElse(win);

        node = node->GetNext();
    }

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Platform & System Engineering

Received on 2025-06-10 15:54:29