14 #include <QApplication>
15 #include <QHeaderView>
16 #include <QMessageBox>
17 #include <QSortFilterProxyModel>
22 GateSelectHistory* GateSelectHistory::inst =
nullptr;
82 if (selectable.
isEmpty())
return true;
90 return mEntries.size();
130 return mEntries.at(irow).id();
141 mSortMechanism = sortMechanism;
169 return checkRow(source_row, source_parent, 0, 2);
174 : mSelectableGates(selectable)
187 Gate* firstAccepted =
nullptr;
189 bool terminate =
true;
213 else if (notAccepted)
271 void GateSelectView::handleDoubleClick(
const QModelIndex& index)
273 const GateSelectProxy* prox =
static_cast<const GateSelectProxy*
>(
model());
275 const GateSelectModel* modl =
static_cast<const GateSelectModel*
>(prox->sourceModel());
276 QModelIndex sourceIndex = prox->mapToSource(index);
277 u32 selGatId = modl->gateId(sourceIndex.
row());
GraphTabWidget * getGraphTabWidget()
Get hal's graph tab widget.
The GateSelectEntry class comprises a single entry of the module selection table.
QVariant data(int icol) const
data returns data from requested column
The GateSelectHistory class singleton comprises a list of user selected modules.
static GateSelectHistory * instance()
The GateSelectModel class is the source model for module selection.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
GateSelectModel(bool history, const QSet< u32 > &selectable=QSet< u32 >(), QObject *parent=nullptr)
GateSelectModel constructor.
u32 gateId(int irow) const
static bool isAccepted(u32 gateId, const QSet< u32 > &selectable)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
GateSelectPicker(const QSet< u32 > &selectable, GateSelectReceiver *receiver)
void triggerCursor(int icurs)
void gatesPicked(QSet< u32 > gats)
void handleSelectionChanged(void *sender)
The GateSelectProxy class allows sorting and filtering of module tables.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
void startSearch(QString text, int options)
GateSelectProxy(QObject *parent=nullptr)
void setSortMechanism(gui_utility::mSortMechanism sortMechanism)
void searchTextChanged(const QString &txt)
bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override
virtual void handleGatesPicked(const QSet< u32 > &gats)=0
GateSelectView(bool history, const QSet< u32 > &selectable, QWidget *parent=nullptr)
GateSelectView constructor.
void gateSelected(u32 gatId, bool doubleClick)
const std::vector< Gate * > & get_gates() const
Gate * get_gate_by_id(const u32 gate_id) const
SearchOptions mSearchOptions
bool checkRow(int sourceRow, const QModelIndex &sourceParent, int startIndex, int endIndex, int offset=0) const
Should be called inside filterAcceptsRow function and returns true if the source_row,...
int numberSelectedItems() const
void selectionChanged(void *sender)
QList< u32 > selectedGatesList() const
int compare(mSortMechanism mechanism, QString a, QString b)
ContentManager * gContentManager
SelectionRelay * gSelectionRelay
void doubleClicked(const QModelIndex &index)
QAbstractItemModel * model() const const
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QItemSelectionModel * selectionModel() const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
void prepend(const T &value)
int removeAll(const T &value)
QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
bool isValid() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QObject * parent() const const
QObject * sender() const const
bool contains(const T &value) const const
QSet::iterator insert(const T &value)
bool isEmpty() const const
void setFilterKeyColumn(int column)
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
void setFilterRegularExpression(const QString &pattern)
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromStdString(const std::string &str)
void sortByColumn(int column)
void resizeColumnsToContents()
virtual void setModel(QAbstractItemModel *model) override
void setSortingEnabled(bool enable)