Engauge Digitizer  2
WindowAbstractBase.cpp
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 <QItemSelectionModel>
8 #include <QModelIndexList>
9 #include <QTableView>
10 #include "WindowAbstractBase.h"
11 
13  QDockWidget (parent)
14 {
15 }
16 
17 WindowAbstractBase::~WindowAbstractBase ()
18 {
19 }
20 
21 void WindowAbstractBase::getTableStatus (bool &tableIsActive,
22  bool &tableIsCopyable) const
23 {
24  tableIsActive = false;
25  tableIsCopyable = false;
26 
27  if (view() != 0) {
28 
29  QItemSelectionModel *selectionModel = view()->selectionModel ();
30  QModelIndexList selection = selectionModel->selectedIndexes ();
31 
32  tableIsActive = view()->hasFocus ();
33  tableIsCopyable = (selection.count () > 0);
34  }
35 }
virtual QTableView * view() const =0
QTableView-based class used by child class.
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
WindowAbstractBase(QWidget *parent)
Single constructor. Parent is needed or else this widget cannot be redocked after being undocked...