[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/libs/plasma
From: Alexis Ménard <menard () kde ! org>
Date: 2008-08-28 20:23:45
Message-ID: 1219955025.083414.27039.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 854098 by menard:
add an activate method to specify if the tooltip has to be displayed or not.
Use-case : Display it on demand, when hovering. ie Kickoff
M +12 -0 private/tooltip.cpp
M +2 -0 private/tooltip_p.h
M +21 -1 tooltipmanager.cpp
M +13 -0 tooltipmanager.h
--- trunk/KDE/kdebase/workspace/libs/plasma/private/tooltip.cpp #854097:854098
@@ -46,6 +46,7 @@
, preview(0)
, windowToPreview(0)
, source(s)
+ , isActivated(true)
{ }
QLabel *label;
@@ -54,6 +55,7 @@
WId windowToPreview;
PanelSvg *background;
QObject *source;
+ bool isActivated;
};
void ToolTip::showEvent(QShowEvent *e)
@@ -139,6 +141,16 @@
}
+void ToolTip::setActivated(bool value)
+{
+ d->isActivated = value;
+}
+
+bool ToolTip::isActivated()
+{
+ return d->isActivated;
+}
+
void ToolTip::resizeEvent(QResizeEvent *e)
{
QWidget::resizeEvent(e);
--- trunk/KDE/kdebase/workspace/libs/plasma/private/tooltip_p.h #854097:854098
@@ -40,6 +40,8 @@
void updateTheme();
void setContent(const ToolTipManager::ToolTipContent &data);
void prepareShowing();
+ void setActivated(bool value);
+ bool isActivated();
protected:
void showEvent(QShowEvent *);
--- trunk/KDE/kdebase/workspace/libs/plasma/tooltipmanager.cpp #854097:854098
@@ -233,6 +233,26 @@
return d->tooltips.contains(widget);
}
+void ToolTipManager::setToolTipActivated(QGraphicsWidget *widget, bool enable)
+{
+ if (!d->tooltips.contains(widget)) {
+ registerWidget(widget);
+ }
+
+ ToolTip *tooltip = d->tooltips.value(widget);
+ tooltip->setActivated(enable);
+}
+
+bool ToolTipManager::isToolTipActivated(QGraphicsWidget *widget)
+{
+ if (!d->tooltips.contains(widget)) {
+ registerWidget(widget);
+ }
+
+ ToolTip *tooltip = d->tooltips.value(widget);
+ return tooltip->isActivated();
+}
+
void ToolTipManagerPrivate::themeUpdated()
{
QMapIterator<QGraphicsWidget*, ToolTip *> iterator(tooltips);
@@ -300,7 +320,7 @@
}
ToolTip *tooltip = tooltips.value(currentWidget);
- if (tooltip) {
+ if (tooltip && tooltip->isActivated()) {
tooltip->setVisible(false);
tooltip->prepareShowing();
tooltip->move(popupPosition(currentWidget, tooltip->size()));
--- trunk/KDE/kdebase/workspace/libs/plasma/tooltipmanager.h #854097:854098
@@ -188,6 +188,19 @@
*/
bool widgetHasToolTip(QGraphicsWidget *widget) const;
+ /**
+ * Enable/or disable a Tooltip, this method is usefull is we want
+ * to have a tooltip activated on demand.
+ * @param widget the widget to change tooltip behaviour
+ * @param enable if we need the tooltip or not
+ */
+ void setToolTipActivated(QGraphicsWidget *widget, bool enable);
+
+ /**
+ * Return true is the tooltip will be displayed, false otherwise
+ */
+ bool isToolTipActivated(QGraphicsWidget *widget);
+
private:
friend class ToolTipManagerSingleton;
bool eventFilter(QObject *watched, QEvent *event);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic