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 8379941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:19:23+00:00 2026-06-09T16:19:23+00:00

I bet my question is obvious from it’s title but it may be as

  • 0

I bet my question is obvious from it’s title but it may be as well not =)
So let me explain in detail… I have created a QDockWidget and then transformed (I mean promoted to..) it into a subclass using the designer.

So how do I properly access the widgets I’ve placed? The idea is that all the subclass’ objects are dealt within the subclass. The problem (as you may be aware) is that

this->children().count()

Returns this:

QDockWidgetLayout(0x1022373d0) 
QDockWidgetTitleButton(0x102237510, name = "qt_dockwidget_floatbutton") 
QDockWidgetTitleButton(0x102235500, name = "qt_dockwidget_closebutton") 
QWidgetResizeHandler(0x102235de0) 
QAction(0x102221500) 

And none of them contain QLabels and other tish that I want to get my hands on). Looking in ui_mainwindow.h however shed some light on the matter. Widgets are on a dockWidgetContents_3 who is a QWidget that has no parent. So the only way seems to be accessing it through MainWinsow’s ui->… And thinking of making ui public makes me a “very sad panda”…

Thanks in advance!

  • 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-06-09T16:19:25+00:00Added an answer on June 9, 2026 at 4:19 pm

    When you say “I have created a QDockWidget and then transformed it into a subclass using the designer”, the only thing I can think that this means is that you used the “promote to…” action to turn it into a placeholder for your coded subclass of a QDockWidget. What that means is it expects to place the version from your code in that spot. If your designer has widgets that are laid out within that dock widget, they will not be automatically composed into that class definition. Where they would live is as attributes on the ui object, parallel to that same dock widget.

    If you wanted say a QLabel, and a QPushButton, to be composed as part of that custom subclass, then what you need to do is define them in code, and not as part of the visual layout. Then they would be members of that actual subclass.

    As of right now, I believe you would find a nested QLabel right on your ui:

    ui->dockWidgetContents_3
    ui->pushButton_1
    ui->label_1
    

    (or however you have chosen to include your ui in your class)

    Now lets say you wanted to still be able to visually design the content area of your QDockWidget. What you might do is design that as a separate widget visually. Then promote the dockWidgetContents of the QDockWidget to your custom QWidget. It will then be able to place this composition as a widget with its own children.

    ui->CustomDockWidget->widget()->label_1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

maybe this is not a technical question but I bet here are many experienced
i bet im not looking well but I cannot seem to find the answer
I bet somebody has solved this before, but my searches have come up empty.
I have two tables (well, two relevant for this question) : Bets (holds the
Simple question, but I'll bet that asking on here will probably be more straight
I would bet this is a very basic question, but i don't get it!
I know the question title isn't amazing, but I can't think of a better
I bet that I could find the answer of this question from reading similar
The question is in the title... I searched but couldn't find anything. Edit: I
I looked on this SO question but I am not sure if this is

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.