forked from qt-creator/qt-creator
QmlDesigner: Use item library model
It should be the current model. Doument model could be detached. Change-Id: Id06f69a1f8dc7b9099cb98a6009f23babb82ac55 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -81,9 +81,6 @@ bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget event filter", category()};
|
||||
|
||||
auto document = QmlDesignerPlugin::instance()->currentDesignDocument();
|
||||
Model *model = document ? document->documentModel() : nullptr;
|
||||
|
||||
if (event->type() == QEvent::FocusOut) {
|
||||
if (obj == m_itemsWidget->quickWidget())
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "closeContextMenu");
|
||||
@@ -109,11 +106,11 @@ bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (model) {
|
||||
model->startDrag(m_itemLibraryModel->getMimeData(entry),
|
||||
::Utils::StyleHelper::dpiSpecificImageFile(
|
||||
entry.libraryEntryIconPath()),
|
||||
this);
|
||||
if (m_model) {
|
||||
m_model->startDrag(m_itemLibraryModel->getMimeData(entry),
|
||||
::Utils::StyleHelper::dpiSpecificImageFile(
|
||||
entry.libraryEntryIconPath()),
|
||||
this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user