Results 1 to 2 of 2

Thread: Label in QListWidget not removed on D&D

  1. #1

    Default Label in QListWidget not removed on D&D

    Hi all,

    Qt Code:
    1. I have a QListWidget (an object that inherits from QListWidget actually, [CODE]TA5WorkflowBuilderAppListWidget
    To copy to clipboard, switch view to plain text mode 
    ). I set a label to it, and i set it as a backgroundlabel.

    m_wfBuilderUI->Datasets = new TA5WorkflowBuilderAppListWidget;

    m_wfBuilderUI->Datasets->setAcceptDrops( true );
    m_wfBuilderUI->Datasets->setStyleSheet( QL1s( "background-color:#f0f0f0" ) );
    m_wfBuilderUI->Datasets->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );

    m_wfBuilderUI->bgLabelInputs = new QLabel( QL1s( "<b>Please drop your datasets here</b>" ), m_wfBuilderUI->Datasets );
    m_wfBuilderUI->bgLabelInputs->setProperty("BackgroundLabel", true);

    m_wfBuilderUI->bgLabelInputs->setStyleSheet( QL1s( "margin:2px; font-size:17px; color:#808080 " ) );
    m_wfBuilderUI->bgLabelInputs->setScaledContents(true);
    m_wfBuilderUI->bgLabelInputs->setWordWrap(true);

    m_wfBuilderUI->firstPageContentLayout->insertWidget( 0, m_wfBuilderUI->Datasets );[/CODE]

    However, on D&D, labels stays in front, whereas droped item is behind. Do you see from code why it is so ? How can I handle that ?

    Thanks

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Label in QListWidget not removed on D&D

    However, on D&D, labels stays in front, whereas droped item is behind. Do you see from code why it is so ? How can I handle that ?
    QLabel is created as child widget of QTableWidget, child is dwarn over the parent.

    The simple way would be to add both QLabel and QTableWidget to a QStackedLayout of another QWidget, and will need to twik the widget background style settings to that the widgets are visible as seethrough.

    and BTW I don't think there is any property named "BackgroundLabel" for QLabel.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. QtTelnet class removed
    By Helene Cormier in forum Qt Programming
    Replies: 4
    Last Post: 2nd June 2012, 07:28
  2. QListWidget - signal when items are added/removed
    By Andrej08 in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2011, 02:13
  3. Markers are not removed from QwtPlot
    By MuzZviman in forum Qwt
    Replies: 1
    Last Post: 3rd June 2010, 07:25
  4. Drop indicator not removed after dropEvent() in QListWidget
    By Daniel Dekkers in forum Qt Programming
    Replies: 0
    Last Post: 9th April 2010, 14:49
  5. viewing removed but not submitted rows
    By maxel in forum Qt Programming
    Replies: 6
    Last Post: 6th October 2006, 17:20

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.