#include <QObject>
+class QAbstractItemModel;
class QAbstractListModel;
class QModelIndex;
class QListView;
class QPushButton;
class QVariant;
+class QAbstractItemView;
+class QItemSelection;
template <class T, class U> class QMap;
namespace lyx {
public:
///
GuiSelectionManager(
- QListView * availableLV,
- QListView * selectedLV,
+ QAbstractItemView * availableLV,
+ QAbstractItemView * selectedLV,
QPushButton * addPB,
QPushButton * delPB,
QPushButton * upPB,
QPushButton * downPB,
QAbstractListModel * availableModel,
- QAbstractListModel * selectedModel);
+ QAbstractItemModel * selectedModel,
+ int const main_sel_col = 0);
/// Sets the state of the various push buttons, depending upon the
/// state of the widgets. (E.g., "delete" is enabled only if the
/// selection is non-empty.)
/// to be used, for example, in displaying information about a
/// highlighted item: should it be the highlighted available item
/// or the highlighted selected item that is displayed?
- bool selectedFocused() { return selectedHasFocus_; };
+ bool selectedFocused() const { return selectedHasFocus_; }
+ /// Returns the selected index. Note that this will depend upon
+ /// selectedFocused().
+ QModelIndex getSelectedIndex(int const c = 0) const;
Q_SIGNALS:
/// Emitted when the list of selected items has changed.
/// been selected (i.e., is also in selectedLV).
bool isSelected(const QModelIndex & idx);
///
- bool insertRowToSelected(int i, QMap<int, QVariant> const & itemData);
+ bool insertRowToSelected(int i, QMap<int, QVariant> const & itemData);
///
- QListView * availableLV;
+ bool insertRowToSelected(int i, QMap<int, QMap<int, QVariant>> &);
///
- QListView * selectedLV;
+ QAbstractItemView * availableLV;
+ ///
+ QAbstractItemView * selectedLV;
///
QPushButton * addPB;
///
///
QAbstractListModel * availableModel;
///
- QAbstractListModel * selectedModel;
+ QAbstractItemModel * selectedModel;
protected Q_SLOTS:
///
- void availableChanged(const QModelIndex & idx, const QModelIndex &);
+ void availableChanged(QModelIndex const & idx, QModelIndex const &);
+ ///
+ void selectedChanged(QModelIndex const & idx, QModelIndex const &);
+ ///
+ void availableChanged(QItemSelection const & qis, QItemSelection const &);
+ ///
+ void selectedChanged(QItemSelection const & qis, QItemSelection const &);
///
- void selectedChanged(const QModelIndex & idx, const QModelIndex &);
+ void selectedEdited();
///
virtual void addPB_clicked();
///
///
virtual void downPB_clicked();
///
- void availableLV_clicked(const QModelIndex &);
- ///
void availableLV_doubleClicked(const QModelIndex &);
///
- void selectedLV_clicked(const QModelIndex &);
- ///
bool eventFilter(QObject *, QEvent *);
private:
virtual void updateUpPB();
///
bool selectedHasFocus_;
+ ///
+ int main_sel_col_;
};
} // namespace frontend