Engauge Digitizer 2
Loading...
Searching...
No Matches
WindowTable.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include <qdebug.h>
8#include <QHeaderView>
9#include <QMouseEvent>
10#include <QStandardItemModel>
11#include "WindowModelBase.h"
12#include "WindowTable.h"
13
14// Modes:
15// -ContiguousSelection is an ok selection mode when dragging is disabled since user can click and drag
16// to easily define a rectangular selection. However, dragging changes that sequence into the start of a drag and drop.
17// -ExtendedSelection is best selection mode when dragging is disabled since it acts as ContiguousSelection and also
18// allows control-click to select/unselect individual cells
19// -MultiSelection is frustrating since user cannot easily remove existing selection by clicking on an unselected cell,
20// which results in tedious deselections
21const QAbstractItemView::SelectionMode SELECTION_MODE = QAbstractItemView::ExtendedSelection;
22
24{
25 horizontalHeader()->setStretchLastSection (true);
26 setModel (&model);
28 // setDragEnabled (true); This is set later from MainWindowModel
29 setDragDropMode (QAbstractItemView::DragOnly);
30 horizontalHeader()->hide();
31 verticalHeader()->hide();
32 setEditTriggers (QAbstractItemView::NoEditTriggers); // Control is read only
33
34 // No WhatsThis text is needed since this table is within a dockable widget that has the same WhatsThis text for
35 // a click anywhere in that widget
36
37 // Connect model to view so model can access the current selection
38 model.setView (*this);
39}
40
44
46{
47 QTableView::focusInEvent (event);
48
50}
51
53{
54 QTableView::focusOutEvent (event);
55
57}
58
61{
62 QTableView::selectionChanged (selected,
64
66}
const int INNER_RADIUS_MIN
const QAbstractItemView::SelectionMode SELECTION_MODE
Model for WindowTable.
virtual void focusOutEvent(QFocusEvent *)
Catch this table status change.
virtual void focusInEvent(QFocusEvent *)
Catch this table status change.
void signalTableStatusChange()
Sent when a change occurs that should affect the Copy menu item.
WindowTable(WindowModelBase &model)
Single constructor.
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Catch this table status change.