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

  • Home
  • SEARCH
  • 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 6621815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:19:10+00:00 2026-05-25T21:19:10+00:00

Here is the environment first: I have a self defined Property Editor which is

  • 0

Here is the environment first:
I have a self defined “Property Editor” which is a QGroupBox (derives from QWidget)
Currently I have a class let’s call it “Holder”, which has a reference to two of the Property Editors.

Now I have multiple “Holder” classes and one vertical QVBoxLayout (called Sidebar).
In this layout I want both of the Property Editors of the currently selected Holder class to be displayed.

And there is the issue:
When the user selects another holder class, I want the Property Editors of the previously selected Holder class to disappear, and add the Property Editors of the new selected Holder class.

Selecting another Holder class works once. But when I select the first Holder class again, The editors don’t seem to change. Why? Does “takeAt(..)” destroy the reference in the holder class? How can I get the desired behavior?

Here is the code, thanks in advance:

void App::setSelection(Holder * holder){
    if(m_currentlySelected == holder) return;

    m_viewer->sideBarRemoveAt(0);
    m_viewer->sideBarInsertAt(0, holder->firstPropEditor);
    m_viewer->sideBarRemoveAt(1);
    m_viewer->sideBarInsertAt(1, holder->secondPropEditor);

    m_currentlySelected = holder;
}

void QtViewer::sideBarRemoveAt(int i){
    m_sideBar->m_layout->takeAt(i);
}

void QtViewer::sideBarInsertAt(int i, QWidget * widget){
    m_sideBar->m_layout->insertWidget(i, widget);
}
  • 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-25T21:19:11+00:00Added an answer on May 25, 2026 at 9:19 pm

    QLayout::takeAt() doesn’t remove the widget of the QLayoutItem from its parent widget. The only reason it may seem to work the first time is probably because the other widgets were above (z-index wise) the first ones.

    Rather than playing with the layout, you could

    • just hide/show your 2 PropertyEditor whenever the holder changes, hidden items don’t generate holes in the layout, the next visible item is displayed as if the hidden items were not part of the layout, or
    • use a QStackedWidget to stack all the PropertyEditor at the same place and select which one is displayed (with QStackedWidget::setCurrentIndex()).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have essentially the same problem discussed here: http://khason.net/blog/dependency-property-getters-and-setters-in-multithreaded-environment/ public static readonly DependencyProperty MyPropertyProperty
First up, here's a little bit about my environment: Using MSSMS as my database
Environment: I have a program - named CSIS - which I need to run
When my applet starts up the first time from a clean environment, things work
First three elements of the background: I have created a Excel Template which is
in my app in the first activity i have created a database which stores
Bit of an open-ended question here, so I'll outline the problem first. We have
From what I have seen, in the MSDN documentation and in other questions here
First the environment: Rails 2.1.0, Ruby 1.8.7, Mysql 5.1.54, Ubuntu 11.04 I have a
Environment: I have that User entity : @Entity public class User implements Serializable {

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.