Engauge Digitizer 2
Loading...
Searching...
No Matches
WindowTable Class Reference

Table view class with support for both drag-and-drop and copy-and-paste. More...

#include <WindowTable.h>

Inheritance diagram for WindowTable:
Inheritance graph
Collaboration diagram for WindowTable:
Collaboration graph

Signals

void signalTableStatusChange ()
 Sent when a change occurs that should affect the Copy menu item.

Public Member Functions

 WindowTable (WindowModelBase &model)
 Single constructor.
 ~WindowTable ()
virtual void focusInEvent (QFocusEvent *)
 Catch this table status change.
virtual void focusOutEvent (QFocusEvent *)
 Catch this table status change.
virtual void mouseMoveEvent (QMouseEvent *event)
 Trigger drag operation if cursor was dragged more than a minimum distance.
virtual void mousePressEvent (QMouseEvent *event)
 Track the starting point of drag operations.
virtual void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 Catch this table status change.

Detailed Description

Table view class with support for both drag-and-drop and copy-and-paste.

Definition at line 18 of file WindowTable.h.

Constructor & Destructor Documentation

◆ WindowTable()

WindowTable::WindowTable ( WindowModelBase & model)

Single constructor.

Definition at line 28 of file WindowTable.cpp.

29{
30 horizontalHeader()->setStretchLastSection (true);
31 setModel (&model);
32 setSelectionMode (SELECTION_MODE);
33 // setDragEnabled (true); This is set later from MainWindowModel
34 setDragDropMode (QAbstractItemView::DragOnly);
35 horizontalHeader()->hide();
36 verticalHeader()->hide();
37 setEditTriggers (QAbstractItemView::NoEditTriggers); // Control is read only
38
39 // No WhatsThis text is needed since this table is within a dockable widget that has the same WhatsThis text for
40 // a click anywhere in that widget
41
42 // Connect model to view so model can access the current selection
43 model.setView (*this);
44}
const QAbstractItemView::SelectionMode SELECTION_MODE
void setView(WindowTable &view)
Save the view so this class can access the current selection.

◆ ~WindowTable()

WindowTable::~WindowTable ( )

Definition at line 46 of file WindowTable.cpp.

47{
48}

Member Function Documentation

◆ focusInEvent()

void WindowTable::focusInEvent ( QFocusEvent * event)
virtual

Catch this table status change.

Definition at line 108 of file WindowTable.cpp.

109{
110 QTableView::focusInEvent (event);
111
113}
void signalTableStatusChange()
Sent when a change occurs that should affect the Copy menu item.

◆ focusOutEvent()

void WindowTable::focusOutEvent ( QFocusEvent * event)
virtual

Catch this table status change.

Definition at line 115 of file WindowTable.cpp.

116{
117 QTableView::focusOutEvent (event);
118
120}

◆ mouseMoveEvent()

void WindowTable::mouseMoveEvent ( QMouseEvent * event)
virtual

Trigger drag operation if cursor was dragged more than a minimum distance.

Definition at line 122 of file WindowTable.cpp.

123{
124 // Only use left clicks
125 if (! (event->buttons() & Qt::LeftButton)) {
126 return;
127 }
128
129 // Ignore small moves
130 if ((event->pos() - m_pressPos).manhattanLength() < QApplication::startDragDistance ()) {
131 return;
132 }
133
134 doDragAndClipboardCopy ();
135
136 QTableView::mouseMoveEvent (event);
137}

◆ mousePressEvent()

void WindowTable::mousePressEvent ( QMouseEvent * event)
virtual

Track the starting point of drag operations.

Definition at line 139 of file WindowTable.cpp.

140{
141 // Only use left clicks
142 if (event->button() == Qt::LeftButton) {
143 m_pressPos = event->pos();
144 }
145
146 QTableView::mousePressEvent (event);
147}

◆ selectionChanged()

void WindowTable::selectionChanged ( const QItemSelection & selected,
const QItemSelection & deselected )
virtual

Catch this table status change.

Definition at line 149 of file WindowTable.cpp.

151{
152 QTableView::selectionChanged (selected,
153 deselected);
154
156}

◆ signalTableStatusChange

void WindowTable::signalTableStatusChange ( )
signal

Sent when a change occurs that should affect the Copy menu item.


The documentation for this class was generated from the following files: