Displays mod data in the form of a mod list using a ModListModel.
More...
#include <modlistview.h>
|
void | modAdded (QList< QUrl > path) |
| Signals files have been dropped into this widget.
|
|
void | modStatusChanged (int mod_id, bool status) |
| Signals that a mods activation status has been changed.
|
|
void | modRemoved (int mod_id, QString name) |
| Signals that a mod has been removed.
|
|
|
| ModListView (QWidget *parent=nullptr) |
| Simply calls QTableview's constructor with parent as argument.
|
|
bool | enableButtons () const |
| Returns true iff buttons in this view will react to mouse inputs.
|
|
void | setEnableButtons (bool enabled) |
| Sets whether buttons in this view will react to mouse inputs.
|
|
int | getHoverRow () const |
| Returns the row currently under the mouse, or -1 if no row is under the mouse.
|
|
bool | isInDragDrop () const |
| Returns true iff an item is currently being moved by drag and drop.
|
|
bool | mouseInUpperHalfOfRow () const |
| Returns true iff mouse is currently in the upper half of a row.
|
|
int | getNumSelectedRows () const |
| Returns the number of currently selected rows.
|
|
std::vector< int > | getSelectedModIds () const |
| Returns a vector of selected mod ids.
|
|
QModelIndexList | getSelectedRowIndices () const |
| Returns one index for every selected row. Columns will be set to 0.
|
|
|
void | dropEvent (QDropEvent *event) override |
| If dropped item was a file or a list of files, emit modAdded.
|
|
void | dragEnterEvent (QDragEnterEvent *event) override |
| Enables drag enter events.
|
|
void | dragLeaveEvent (QDragLeaveEvent *event) override |
| Enables drag leave events.
|
|
void | dragMoveEvent (QDragMoveEvent *event) override |
| Enables drag move events.
|
|
void | mousePressEvent (QMouseEvent *event) override |
| Gets called when the mouse has been pressed while in this widget.
|
|
void | mouseReleaseEvent (QMouseEvent *event) override |
| Gets called when the mouse has been released while in this widget.
|
|
void | mouseMoveEvent (QMouseEvent *event) override |
| Gets called when the mouse has been moved while in this widget.
|
|
void | mouseDoubleClickEvent (QMouseEvent *event) override |
| Gets called when a double click has been performed in this widget.
|
|
void | leaveEvent (QEvent *event) override |
| Gets called when the cursor leaves this widget. Resets mouse over highlighting.
|
|
void | focusOutEvent (QFocusEvent *event) override |
| Gets called when this widget loses focus. Changes highlight color to inactive.
|
|
void | focusInEvent (QFocusEvent *event) override |
| Gets called when this widget gains focus. Changes highlight color to active.
|
|
QModelIndex | moveCursor (QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override |
| Disables moving the cursor with keyboard inputs.
|
|
bool | rowIndexIsValid (int row) const |
| Checks if given row index refers to an existing row.
|
|
void | updateMouseHoverRow (int row) |
| Sets mouse_hover_row_ to the given row and updates the view accordingly.
|
|
void | updateMouseDownRow (int row) |
| Sets mouse_down_row_ to the given row and updates the view accordingly.
|
|
void | updateRow (int row) |
| Repaints the given rows.
|
|
|
int | mouse_down_row_ = -1 |
| Last row on which a mouse button has been pressed.
|
|
int | mouse_hover_row_ = -1 |
| Last row over which the cursor hovered.
|
|
bool | enable_buttons_ = true |
| Determines if buttons react to inputs.
|
|
bool | is_in_drag_drop_ = false |
| Indicates if an item is currently being moved by drag and drop.
|
|
bool | mouse_in_upper_half_of_row_ = false |
| Stores if mouse is currently in the upper half of a row.
|
|
Displays mod data in the form of a mod list using a ModListModel.
◆ ModListView()
ModListView::ModListView |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Simply calls QTableview's constructor with parent as argument.
- Parameters
-
parent | The parent widget for this widget. |
◆ dragEnterEvent()
void ModListView::dragEnterEvent |
( |
QDragEnterEvent * | event | ) |
|
|
overrideprotected |
Enables drag enter events.
- Parameters
-
◆ dragLeaveEvent()
void ModListView::dragLeaveEvent |
( |
QDragLeaveEvent * | event | ) |
|
|
overrideprotected |
Enables drag leave events.
- Parameters
-
◆ dragMoveEvent()
void ModListView::dragMoveEvent |
( |
QDragMoveEvent * | event | ) |
|
|
overrideprotected |
Enables drag move events.
- Parameters
-
◆ dropEvent()
void ModListView::dropEvent |
( |
QDropEvent * | event | ) |
|
|
overrideprotected |
If dropped item was a file or a list of files, emit modAdded.
- Parameters
-
◆ enableButtons()
bool ModListView::enableButtons |
( |
| ) |
const |
Returns true iff buttons in this view will react to mouse inputs.
- Returns
- The button status.
◆ focusInEvent()
void ModListView::focusInEvent |
( |
QFocusEvent * | event | ) |
|
|
overrideprotected |
Gets called when this widget gains focus. Changes highlight color to active.
- Parameters
-
◆ focusOutEvent()
void ModListView::focusOutEvent |
( |
QFocusEvent * | event | ) |
|
|
overrideprotected |
Gets called when this widget loses focus. Changes highlight color to inactive.
- Parameters
-
◆ getHoverRow()
int ModListView::getHoverRow |
( |
| ) |
const |
Returns the row currently under the mouse, or -1 if no row is under the mouse.
- Returns
- The row.
◆ getNumSelectedRows()
int ModListView::getNumSelectedRows |
( |
| ) |
const |
Returns the number of currently selected rows.
- Returns
- The number of rows.
◆ getSelectedModIds()
std::vector< int > ModListView::getSelectedModIds |
( |
| ) |
const |
Returns a vector of selected mod ids.
- Returns
- The vector.
◆ getSelectedRowIndices()
QModelIndexList ModListView::getSelectedRowIndices |
( |
| ) |
const |
Returns one index for every selected row. Columns will be set to 0.
- Returns
- The list.
◆ isInDragDrop()
bool ModListView::isInDragDrop |
( |
| ) |
const |
Returns true iff an item is currently being moved by drag and drop.
- Returns
- True while in drag drop mode.
◆ leaveEvent()
void ModListView::leaveEvent |
( |
QEvent * | event | ) |
|
|
overrideprotected |
Gets called when the cursor leaves this widget. Resets mouse over highlighting.
- Parameters
-
◆ modAdded
void ModListView::modAdded |
( |
QList< QUrl > | path | ) |
|
|
signal |
Signals files have been dropped into this widget.
- Parameters
-
path | Paths to the dropped files. |
◆ modRemoved
void ModListView::modRemoved |
( |
int | mod_id, |
|
|
QString | name ) |
|
signal |
Signals that a mod has been removed.
- Parameters
-
mod_id | Id of the mod which is to be removed. |
name | Name of the mod which is to be removed. |
◆ modStatusChanged
void ModListView::modStatusChanged |
( |
int | mod_id, |
|
|
bool | status ) |
|
signal |
Signals that a mods activation status has been changed.
- Parameters
-
mod_id | Target mod. |
status | New mod status. |
◆ mouseDoubleClickEvent()
void ModListView::mouseDoubleClickEvent |
( |
QMouseEvent * | event | ) |
|
|
overrideprotected |
Gets called when a double click has been performed in this widget.
Calls the respective editor for mod name and mod version name.
- Parameters
-
◆ mouseInUpperHalfOfRow()
bool ModListView::mouseInUpperHalfOfRow |
( |
| ) |
const |
Returns true iff mouse is currently in the upper half of a row.
- Returns
- True iff mouse is currently in the upper half of a row.
◆ mouseMoveEvent()
void ModListView::mouseMoveEvent |
( |
QMouseEvent * | event | ) |
|
|
overrideprotected |
Gets called when the mouse has been moved while in this widget.
Highlights the row currently under the cursor.
- Parameters
-
◆ mousePressEvent()
void ModListView::mousePressEvent |
( |
QMouseEvent * | event | ) |
|
|
overrideprotected |
Gets called when the mouse has been pressed while in this widget.
Highlights the currently selected row and forwards edit events.
- Parameters
-
◆ mouseReleaseEvent()
void ModListView::mouseReleaseEvent |
( |
QMouseEvent * | event | ) |
|
|
overrideprotected |
Gets called when the mouse has been released while in this widget.
If the mouse was released on column 0 and the same row on which it was pressed: Emits modRemoved.
- Parameters
-
◆ moveCursor()
QModelIndex ModListView::moveCursor |
( |
QAbstractItemView::CursorAction | cursorAction, |
|
|
Qt::KeyboardModifiers | modifiers ) |
|
overrideprotected |
Disables moving the cursor with keyboard inputs.
- Parameters
-
cursorAction | Action taken. |
modifiers | Key modifiers. |
- Returns
- The current model index.
◆ rowIndexIsValid()
bool ModListView::rowIndexIsValid |
( |
int | row | ) |
const |
|
protected |
Checks if given row index refers to an existing row.
- Parameters
-
- Returns
- True if index is valid.
◆ setEnableButtons()
void ModListView::setEnableButtons |
( |
bool | enabled | ) |
|
Sets whether buttons in this view will react to mouse inputs.
- Parameters
-
enabled | Button will react iff this is true. |
◆ updateMouseDownRow()
void ModListView::updateMouseDownRow |
( |
int | row | ) |
|
|
protected |
Sets mouse_down_row_ to the given row and updates the view accordingly.
- Parameters
-
row | Row which has been clicked. |
◆ updateMouseHoverRow()
void ModListView::updateMouseHoverRow |
( |
int | row | ) |
|
|
protected |
Sets mouse_hover_row_ to the given row and updates the view accordingly.
- Parameters
-
row | New row under the mouse. |
◆ updateRow()
void ModListView::updateRow |
( |
int | row | ) |
|
|
protected |
Repaints the given rows.
- Parameters
-
The documentation for this class was generated from the following files: