Changeset 181 for smplayer/trunk/src/autohidewidget.cpp
- Timestamp:
- Aug 31, 2016, 5:31:04 PM (9 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/autohidewidget.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 179
- Property svn:mergeinfo changed
-
smplayer/trunk/src/autohidewidget.cpp
r176 r181 22 22 #include <QVBoxLayout> 23 23 #include <QMouseEvent> 24 25 24 26 #include <QDebug> 25 27 26 28 #if QT_VERSION >= 0x040600 27 29 #include <QPropertyAnimation> 30 31 32 33 34 35 28 36 #endif 29 37 … … 46 54 setLayoutDirection(Qt::LeftToRight); 47 55 48 parent->installEventFilter(this); 49 installFilter(parent); 56 QWidget * widget_to_watch = parent; 57 widget_to_watch->installEventFilter(this); 58 installFilter(widget_to_watch); 50 59 51 60 timer = new QTimer(this); … … 66 75 67 76 void AutohideWidget::setInternalWidget(QWidget * w) { 77 68 78 layout()->addWidget(w); 69 79 internal_widget = w; … … 87 97 w->installEventFilter(this); 88 98 installFilter(children[n]); 89 } 90 } 99 #ifdef HANDLE_TAP_EVENT 100 //w->grabGesture(Qt::TapGesture); 101 #endif 102 } 103 } 104 } 105 106 bool AutohideWidget::visiblePopups() { 107 //qDebug() << "AutohideWidget::visiblePopups: internal_widget:" << internal_widget; 108 if (!internal_widget) return false; 109 110 // Check if any of the menus in the internal widget is visible 111 QObjectList children = internal_widget->children(); 112 foreach(QObject * child, children) { 113 if (child->isWidgetType()) { 114 //qDebug() << "AutohideWidget::visiblePopups:" << child << "child name:" << child->objectName(); 115 QWidget *w = static_cast<QWidget *>(child); 116 117 QList<QAction *> actions = w->actions(); 118 foreach(QAction * action, actions) { 119 //qDebug() << "AutohideWidget::visiblePopups: action:" << action; 120 121 QList<QWidget *> aw = action->associatedWidgets(); 122 //qDebug() << "AutohideWidget::visiblePopups: aw:" << aw; 123 124 QMenu * menu = 0; 125 foreach(QWidget * widget, aw) { 126 //qDebug() << "AutohideWidget::visiblePopups: widget:" << widget; 127 if ((menu = qobject_cast<QMenu *>(widget))) { 128 //qDebug() << "AutohideWidget::visiblePopups: menu:" << menu << "visible:" << menu->isVisible(); 129 if (menu->isVisible()) return true; 130 } 131 } 132 133 menu = action->menu(); 134 if (menu) { 135 //qDebug() << "AutohideWidget::visiblePopups: menu:" << menu << "visible:" << menu->isVisible(); 136 if (menu->isVisible()) return true; 137 } 138 } 139 } 140 } 141 return false; 91 142 } 92 143 … … 123 174 if (auto_hide) { 124 175 //qDebug("AutohideWidget::checkUnderMouse"); 125 if ((isVisible()) && (!underMouse())) hide(); 176 if (isVisible() && !underMouse() && !visiblePopups()) { 177 hide(); 178 } 126 179 } 127 180 } … … 141 194 if (turned_on) { 142 195 //qDebug() << "AutohideWidget::eventFilter: obj:" << obj << "type:" << event->type(); 196 197 198 199 200 201 202 203 204 205 206 207 208 143 209 if (event->type() == QEvent::MouseMove) { 144 210 //qDebug() << "AutohideWidget::eventFilter: mouse move" << obj; … … 157 223 } 158 224 } 225 226 227 228 229 159 230 } 160 231
Note:
See TracChangeset
for help on using the changeset viewer.
