Widgets Appearances are disappearing...
-
Hello,
I'm dragging from a custom customheader and dropping a qlabel into the qlistwidget.
This process works flawlessly. However, when I hide my working project in the bottom tab of windows and open it again, the views disappear.


KrnLabel *columnLabel = new KrnLabel(_headerDataList.at(i)); columnLabel->setParent(this); //I am using this code to add labels to headerview /-------------------------- addItem(item); // qlistwidget drop event function.. setItemWidget(item,label);and I also used a widget instead of qlistwidget and added a horizontal layout inside. This time I added the labels to the layout. However, when I take the window to the bottom tab and open it again, the labels do not appear in the widget.
-
The label's visible setting is always true. if it wasn't, it wouldn't be visible when I drop the label on the listwidget.
The problem is;
The labels in the listwidget are displayed when I press the hide button at the top right of the project (ie when I take the project to the lower tab)
and when I open it again, the visible label suddenly becomes invisible as in the photo.and when I drag and drop another label on the listwidget while it is invisible, that disappearing label appears in the headerview again...
So it's like it never actually left the headerview...It is really interesting. Is this a bug or am I wrong?
I'm still skeptical of the expression I used when first defining the labels in the headerview.
Label->setParent(this); // first definition at Headerview... -
The label's visible setting is always true. if it wasn't, it wouldn't be visible when I drop the label on the listwidget.
The problem is;
The labels in the listwidget are displayed when I press the hide button at the top right of the project (ie when I take the project to the lower tab)
and when I open it again, the visible label suddenly becomes invisible as in the photo.and when I drag and drop another label on the listwidget while it is invisible, that disappearing label appears in the headerview again...
So it's like it never actually left the headerview...It is really interesting. Is this a bug or am I wrong?
I'm still skeptical of the expression I used when first defining the labels in the headerview.
Label->setParent(this); // first definition at Headerview... -
As @JoeCFD says, if you move the QLabel instance from the layout/list it was in into another parent container object then it is no longer there to be seen in the original place. If the intent is that the gaining container gets a header with the same text as the dropped label then you should implement it that way and leave the original label alone.
As a bonus, it looks possible the main window central widget does not have a layout applied. This can easily lead to unusual behaviour during resizing etc.
-
unfortunately I can't do that. Because the labels need to be placed in the headerview with this.
Otherwise, each label appears as a separate window.is there any other solution?
@Nevez said in Widgets Appearances are disappearing...:
Otherwise, each label appears as a separate window
That's why @JoeCFD wrote: "remove its old parent and add new parent to it after drop"