Changeset View
Changeset View
Standalone View
Standalone View
sidebar/ToolTips/tooltipmanager.h
Show All 32 Lines | |||||
33 | * a short timeout. The tooltip is hidden again when the | 33 | * a short timeout. The tooltip is hidden again when the | ||
34 | * viewport is hovered or the item view has been left. | 34 | * viewport is hovered or the item view has been left. | ||
35 | */ | 35 | */ | ||
36 | class ToolTipManager : public QObject | 36 | class ToolTipManager : public QObject | ||
37 | { | 37 | { | ||
38 | Q_OBJECT | 38 | Q_OBJECT | ||
39 | 39 | | |||
40 | public: | 40 | public: | ||
41 | | ||||
42 | enum ToolTipPosition { BottomCenter, Right }; | ||||
43 | | ||||
41 | /** | 44 | /** | ||
42 | * Standard constructor. The ToolTipManager will start handling ToolTip events on the provided | 45 | * Standard constructor. The ToolTipManager will start handling ToolTip events on the provided | ||
43 | * view immediately. | 46 | * view immediately. | ||
44 | * | 47 | * | ||
45 | * @param parent The view which will have the tooltips displayed for. | 48 | * @param parent The view which will have the tooltips displayed for. | ||
49 | * @param toolTipPosition The position of the tooltip. | ||||
46 | */ | 50 | */ | ||
47 | explicit ToolTipManager(QAbstractItemModel *model, QWidget* parent); | 51 | explicit ToolTipManager(QAbstractItemModel *model, QWidget* parent, ToolTipManager::ToolTipPosition toolTipPosition); | ||
ngraham: Use an Enum here instead of a bool to improve readability. See for example https://codereview. | |||||
48 | ~ToolTipManager() override; | 52 | ~ToolTipManager() override; | ||
49 | 53 | | |||
50 | public Q_SLOTS: | 54 | public Q_SLOTS: | ||
51 | /** | 55 | /** | ||
52 | * Hides the currently shown tooltip. Invoking this method is | 56 | * Hides the currently shown tooltip. Invoking this method is | ||
53 | * only needed when the tooltip should be hidden although | 57 | * only needed when the tooltip should be hidden although | ||
54 | * an item is hovered. | 58 | * an item is hovered. | ||
55 | */ | 59 | */ | ||
Show All 19 Lines |
Use an Enum here instead of a bool to improve readability. See for example https://codereview.stackexchange.com/questions/11300/boolean-enums-improved-clarity-or-just-overkill