Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3358084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:42:35+00:00 2026-05-18T02:42:35+00:00

I have a Qt Designer Class called MainWindow which is a QMainWindow. This class

  • 0

I have a Qt Designer Class called MainWindow which is a QMainWindow. This class creates an MDI Area and has children windows, as MDI should.

One of these MDI children, we’ll call wndChild which is also a QMainWindow, needs to spawn a “sibling” (that is, an MDI child of its parent, not an MDI child of its own). I figured the best way to do that would be to create a public function in the parent (MainWindow) which then creates the new MDI child.

The problem is, I’m not sure how to call this function from the child. I tried something like:

MainWindow *mdiparent=this->parentWidget();
mdiparent->spawnOtherChild();

But QMainWindow::parentWidget returns a pointer to a QWidget, not a QMainWindow, so I of course get an error.

How might I go about doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:42:36+00:00Added an answer on May 18, 2026 at 2:42 am

    Use qobject_cast to get a pointer to MainWindow :

    MainWindow *mdiparent = qobject_cast<MainWindow*>(this->parentWidget());
    mdiparent->spawnOtherChild();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a custom designer class which inherits from DocumentDesigner. The standard Form
Does anybody use the Class Designer much in Visual Studio? I have downloaded the
Windows Forms allows you to develop Components, non-visual elements that can have a designer.
I have a problem in my project with the .designer which as everyone know
Does anyone have any experience hosting the Windows Workflow designer surface? I've seen a
So i have a ASP.NET 4 Custom Control called SafeClickButton which is designed to
I'm using VB.Net. I have a WPF User Control called NavigationPanel which I created
I have a class (class A) that is designed to be inherited by other
I have been programming using PHP, Javascript and have been a designer for a
I have a number of custom controls that I am trying to enable designer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.