EnhancedTreeWidget.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 *
19 * @package ArmarX::RobotAPI
20 * @author Raphael Grimm <raphael dot grimm at kit dot edu>
21 * @date 2017
22 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
23 * GNU General Public License
24 */
25
26#pragma once
27
28#include <QTreeWidget>
29
30namespace armarx
31{
32 /**
33 * @brief The EnhancedTreeWidget is a QTreeWidget with some extra functionalities.
34 *
35 * This TreeWidget:
36 * - has working pixel wise scrolling
37 * - can expand its size to the size of its content (currently visible widgets)
38 * - can be set to auto expadn its size to its content
39 */
40 class EnhancedTreeWidget : public QTreeWidget
41 {
42 Q_OBJECT
43 public:
44 using QTreeWidget::QTreeWidget;
45 int getHeight();
46
47 protected:
48 void wheelEvent(QWheelEvent* event) override;
49 public slots:
50 void expand();
51 void setAutoExpand(bool active);
52 void setWheelTicksPerScrollTick(int wheelTicksPerScrollTick);
53
54 private:
55 int calcHeight(QTreeWidgetItem* it);
56
57 int vdelta = 0;
58 int hdelta = 0;
59 int wheelTicksPerScrollTick = 8;
60 };
61} // namespace armarx
The EnhancedTreeWidget is a QTreeWidget with some extra functionalities.
void setWheelTicksPerScrollTick(int wheelTicksPerScrollTick)
void wheelEvent(QWheelEvent *event) override
This file offers overloads of toIce() and fromIce() functions for STL container types.