Qt
Widgets
pqTreeWidgetCheckHelper.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3
// SPDX-License-Identifier: BSD-3-Clause
4
5
#ifndef pqTreeWidgetCheckHelper_h
6
#define pqTreeWidgetCheckHelper_h
7
8
#include "pqWidgetsModule.h"
9
#include <QObject>
10
11
class
QTreeWidget;
12
class
QTreeWidgetItem;
13
22
class
PQWIDGETS_EXPORT
pqTreeWidgetCheckHelper
:
public
QObject
23
{
24
Q_OBJECT
25
public
:
26
// treeWidget :- the tree widget managed by this helper.
27
// checkableColumn :- column index for the checkable item.
28
// parent :- QObject parent.
29
pqTreeWidgetCheckHelper
(QTreeWidget* treeWidget,
int
checkableColumn, QObject* parent);
30
31
enum
CheckMode
32
{
33
CLICK_IN_COLUMN
,
// toggle check state when clicked in the column
34
// with the checkable item.
35
CLICK_IN_ROW
,
// toggle check state when clicked in the row
36
// with the checkable item (default).
37
};
38
39
// Check Mode controls whether the user must click in the column
40
// with the checkable item or any column in the same row.
41
void
setCheckMode
(
CheckMode
mode) { this->Mode = mode; }
42
CheckMode
checkMode
()
const
{
return
this->Mode; }
43
44
protected
Q_SLOTS:
45
void
onItemClicked(QTreeWidgetItem* item,
int
column);
46
void
onItemPressed(QTreeWidgetItem* item,
int
column);
47
48
private
:
49
Q_DISABLE_COPY(
pqTreeWidgetCheckHelper
)
50
51
QTreeWidget* Tree;
52
int
CheckableColumn;
53
int
PressState;
54
CheckMode
Mode;
55
};
56
57
#endif
pqTreeWidgetCheckHelper::CLICK_IN_COLUMN
Definition:
pqTreeWidgetCheckHelper.h:33
pqTreeWidgetCheckHelper::CheckMode
CheckMode
Definition:
pqTreeWidgetCheckHelper.h:31
pqTreeWidgetCheckHelper::CLICK_IN_ROW
Definition:
pqTreeWidgetCheckHelper.h:35
pqTreeWidgetCheckHelper
If a QTreeWidget has checkable elements in any column, one needs to explicitly click on the checkbox ...
Definition:
pqTreeWidgetCheckHelper.h:22
pqTreeWidgetCheckHelper::checkMode
CheckMode checkMode() const
Definition:
pqTreeWidgetCheckHelper.h:42
pqTreeWidgetCheckHelper::setCheckMode
void setCheckMode(CheckMode mode)
Definition:
pqTreeWidgetCheckHelper.h:41
Generated by
1.8.13 on Tue Jan 21 2025