Commit e133ee89 authored by Eike Ziller's avatar Eike Ziller

Separate locator input widget from result list & popup

The input field may not care whether the result list is actually in a
popup or not.

Change-Id: Ia15f9a32441243de458e4e55d2daef6204b9dd59
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 3a45d763
......@@ -104,6 +104,7 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *)
mtools->addAction(cmd);
auto locatorWidget = new LocatorWidget(this);
new LocatorPopup(locatorWidget, locatorWidget); // child of locatorWidget
StatusBarWidget *view = new StatusBarWidget;
view->setWidget(locatorWidget);
view->setContext(Context("LocatorWidget"));
......
......@@ -54,33 +54,40 @@ class LocatorWidget
public:
explicit LocatorWidget(Locator *locator);
void updateFilterList();
void showText(const QString &text, int selectionStart = -1, int selectionLength = 0);
QString currentText() const;
QAbstractItemModel *model() const;
void updatePlaceholderText(Command *command);
private:
void scheduleAcceptEntry(const QModelIndex &index);
signals:
void showCurrentItemToolTip();
void hidePopup();
void selectRow(int row);
void handleKey(QKeyEvent *keyEvent); // only use with DirectConnection, event is deleted
void parentChanged();
void showPopup();
private:
void showPopupDelayed();
void showPopupNow();
void acceptEntry(int row);
void showConfigureDialog();
void addSearchResults(int firstIndex, int endIndex);
void handleSearchFinished();
void scheduleAcceptEntry(const QModelIndex &index);
void setFocusToCurrentMode();
void updateFilterList();
bool eventFilter(QObject *obj, QEvent *event);
void showCompletionList();
void updateCompletionList(const QString &text);
QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText);
void setProgressIndicatorVisible(bool visible);
LocatorModel *m_locatorModel;
CompletionList *m_completionList;
QMenu *m_filterMenu;
QAction *m_refreshAction;
QAction *m_configureAction;
......@@ -93,9 +100,30 @@ private:
bool m_possibleToolTipRequest = false;
int m_rowRequestedForAccept = -1;
QWidget *m_progressIndicator;
QPointer<QWidget> m_window;
QTimer m_showProgressTimer;
};
class LocatorPopup : public QWidget
{
public:
LocatorPopup(LocatorWidget *locatorWidget, QWidget *parent = 0);
CompletionList *completionList() const;
void focusOutEvent (QFocusEvent *event) override;
void resize();
QSize preferredSize() const;
bool event(QEvent *event) override;
bool eventFilter(QObject *watched, QEvent *event) override;
private:
void showPopup();
CompletionList *m_tree;
QSize m_preferredSize;
QPointer<QWidget> m_window;
void updateWindow();
};
} // namespace Internal
} // namespace Core
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment