PDA

View Full Version : Label in QListWidget not removed on D&D



trust88
9th May 2013, 15:41
Hi all,


I have a QListWidget (an object that inherits from QListWidget actually,
TA5WorkflowBuilderAppListWidget). 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 );

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

Santosh Reddy
10th May 2013, 15:19
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.