| 988 | } |
| 989 | |
| 990 | void QuickOpenLineEdit::focusInEvent(QFocusEvent* ev) |
| 991 | { |
| 992 | QLineEdit::focusInEvent(ev); |
| 993 | // delete m_widget; |
| 994 | qCDebug(PLUGIN_QUICKOPEN) << "got focus"; |
| 995 | qCDebug(PLUGIN_QUICKOPEN) << "old widget" << m_widget << "force update:" << m_forceUpdate; |
| 996 | if (m_widget && !m_forceUpdate) { |
| 997 | return; |
| 998 | } |
| 999 | |
| 1000 | if (!m_forceUpdate && !QuickOpenPlugin::self()->freeModel()) { |
| 1001 | deactivate(); |
| 1002 | return; |
| 1003 | } |
| 1004 | |
| 1005 | m_forceUpdate = false; |
| 1006 | |
| 1007 | if (!m_widget) { |
| 1008 | m_widget = m_widgetCreator->createWidget(); |
| 1009 | if (!m_widget) { |
| 1010 | deactivate(); |
| 1011 | return; |
| 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | activate(); |
| 1016 | |
| 1017 | m_widget->showStandardButtons(false); |
| 1018 | m_widget->showSearchField(false); |
| 1019 | |
| 1020 | m_widget->setParent(nullptr, Qt::ToolTip); |
| 1021 | m_widget->setFocusPolicy(Qt::NoFocus); |
| 1022 | m_widget->setAlternativeSearchField(this); |
| 1023 | |
| 1024 | QuickOpenPlugin::self()->m_currentWidgetHandler = m_widget; |
| 1025 | connect(m_widget.data(), &QuickOpenWidget::ready, this, &QuickOpenLineEdit::deactivate); |
| 1026 | |
| 1027 | connect(m_widget.data(), &QuickOpenWidget::scopesChanged, QuickOpenPlugin::self(), &QuickOpenPlugin::storeScopes); |
| 1028 | connect(m_widget.data(), &QuickOpenWidget::itemsChanged, QuickOpenPlugin::self(), &QuickOpenPlugin::storeItems); |
| 1029 | Q_ASSERT(m_widget->ui.searchLine == this); |
| 1030 | m_widget->prepareShow(); |
| 1031 | QRect widgetGeometry = QRect(mapToGlobal(QPoint(0, height())), mapToGlobal(QPoint(width(), height() + 400))); |
| 1032 | widgetGeometry.setWidth(700); ///@todo Waste less space |
| 1033 | const auto screenGeom = screen()->geometry(); |
| 1034 | if (widgetGeometry.right() > screenGeom.right()) { |
| 1035 | widgetGeometry.moveRight(screenGeom.right()); |
| 1036 | } |
| 1037 | if (widgetGeometry.bottom() > screenGeom.bottom()) { |
| 1038 | widgetGeometry.moveBottom(mapToGlobal(QPoint(0, 0)).y()); |
| 1039 | } |
| 1040 | m_widget->setGeometry(widgetGeometry); |
| 1041 | m_widget->show(); |
| 1042 | |
| 1043 | m_widgetCreator->widgetShown(); |
| 1044 | } |
| 1045 | |
| 1046 | void QuickOpenLineEdit::hideEvent(QHideEvent* ev) |
| 1047 | { |
nothing calls this directly
no test coverage detected