Mantid
Loading...
Searching...
No Matches
HintingLineEditFactory.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include <QPainter>
10#include <QStyledItemDelegate>
11
15#include <boost/scoped_ptr.hpp>
16
17namespace MantidQt {
18namespace MantidWidgets {
22class HintingLineEditFactory : public QStyledItemDelegate {
23public:
24 HintingLineEditFactory(QAbstractItemDelegate *cellPainterDelegate, std::unique_ptr<HintStrategy> hintStrategy,
25 QObject *parent = nullptr)
26 : QStyledItemDelegate(parent), m_strategy(std::move(hintStrategy)), m_cellPainterDelegate(cellPainterDelegate){};
27
28 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override {
29 Q_UNUSED(option);
30 Q_UNUSED(index);
31
32 auto editor = new HintingLineEdit(parent, m_strategy->createHints());
33 editor->setFrame(false);
34
35 return editor;
36 }
37
38 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override {
39 m_cellPainterDelegate->paint(painter, option, index);
40 }
41
42protected:
43 std::unique_ptr<HintStrategy> m_strategy;
44 QAbstractItemDelegate *m_cellPainterDelegate;
45};
46} // namespace MantidWidgets
47} // namespace MantidQt
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
HintingLineEditFactory : A QStyledItemDelegate that produces HintingLineEdits using the given hint st...
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
HintingLineEditFactory(QAbstractItemDelegate *cellPainterDelegate, std::unique_ptr< HintStrategy > hintStrategy, QObject *parent=nullptr)
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
HintingLineEdit : A QLineEdit widget providing autocompletion.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
STL namespace.