Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Widgets Appearances are disappearing...

Widgets Appearances are disappearing...

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 775 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NevezN Offline
    NevezN Offline
    Nevez
    wrote on last edited by Nevez
    #1

    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.
    e35df73b-a779-4b4b-b7b1-fe818f5743dd-image.png

    d4fba2c6-9232-4911-a3e9-39097669d02d-image.png

    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.

    1 Reply Last reply
    0
    • NevezN Offline
      NevezN Offline
      Nevez
      wrote on last edited by
      #2

      any idea ?

      1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        check if any widget myWidget->isVisible(). If not, myWidget->setVisible( true );
        add update call after layout change.

        1 Reply Last reply
        0
        • NevezN Offline
          NevezN Offline
          Nevez
          wrote on last edited by
          #4

          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...
          
          JoeCFDJ 1 Reply Last reply
          0
          • NevezN Nevez

            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...
            
            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            @Nevez Label->setParent(this); remove its old parent and add new parent to it after drop.

            1 Reply Last reply
            0
            • NevezN Offline
              NevezN Offline
              Nevez
              wrote on last edited by
              #6

              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?

              jsulmJ 1 Reply Last reply
              0
              • C Offline
                C Offline
                ChrisW67
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • NevezN Nevez

                  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?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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"

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved