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 
30 namespace 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  protected:
47  void wheelEvent(QWheelEvent* event) override;
48  public slots:
49  void expand();
50  void setAutoExpand(bool active);
51  void setWheelTicksPerScrollTick(int wheelTicksPerScrollTick);
52  private:
53  int calcHeight(QTreeWidgetItem* it);
54 
55  int vdelta = 0;
56  int hdelta = 0;
57  int wheelTicksPerScrollTick = 8;
58  };
59 }
armarx::EnhancedTreeWidget
The EnhancedTreeWidget is a QTreeWidget with some extra functionalities.
Definition: EnhancedTreeWidget.h:40
armarx::EnhancedTreeWidget::setWheelTicksPerScrollTick
void setWheelTicksPerScrollTick(int wheelTicksPerScrollTick)
Definition: EnhancedTreeWidget.cpp:49
armarx::EnhancedTreeWidget::getHeight
int getHeight()
Definition: EnhancedTreeWidget.cpp:35
armarx::EnhancedTreeWidget::setAutoExpand
void setAutoExpand(bool active)
Definition: EnhancedTreeWidget.cpp:91
armarx::EnhancedTreeWidget::expand
void expand()
Definition: EnhancedTreeWidget.cpp:85
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::EnhancedTreeWidget::wheelEvent
void wheelEvent(QWheelEvent *event) override
Definition: EnhancedTreeWidget.cpp:54