Permalink
Browse files

MythUIWebBrowser: allow the scrollbars to overlap the browser when se…

…t to fade
  • Loading branch information...
1 parent 4b9602d commit 4b66f82cf89e2b50fd2e7a728897a7fd173aca87 Paul Harrison committed Mar 29, 2013
Showing with 42 additions and 15 deletions.
  1. +39 −15 mythtv/libs/libmythui/mythuiwebbrowser.cpp
  2. +3 −0 mythtv/libs/libmythui/mythuiwebbrowser.h
@@ -889,12 +889,20 @@ void MythUIWebBrowser::Init(void)
{
QWebFrame* frame = m_browser->page()->currentFrame();
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
+ connect(m_horizontalScrollbar, SIGNAL(Hiding()),
+ this, SLOT(slotScrollBarHiding()));
+ connect(m_horizontalScrollbar, SIGNAL(Showing()),
+ this, SLOT(slotScrollBarShowing()));
}
if (m_verticalScrollbar)
{
QWebFrame* frame = m_browser->page()->currentFrame();
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
+ connect(m_verticalScrollbar, SIGNAL(Hiding()),
+ this, SLOT(slotScrollBarHiding()));
+ connect(m_verticalScrollbar, SIGNAL(Showing()),
+ this, SLOT(slotScrollBarShowing()));
}
// if we have a valid css URL use that ...
@@ -1347,14 +1355,39 @@ void MythUIWebBrowser::slotIconChanged(void)
emit iconChanged();
}
+void MythUIWebBrowser::slotScrollBarShowing(void)
+{
+ bool wasActive = (m_wasActive | m_active);
+ SetActive(false);
+ m_wasActive = wasActive;
+}
+
+void MythUIWebBrowser::slotScrollBarHiding(void)
+{
+ SetActive(m_wasActive);
+ slotTopScreenChanged(NULL);
+}
+
void MythUIWebBrowser::slotTopScreenChanged(MythScreenType *screen)
{
(void) screen;
- if (!m_parentScreen)
- return;
+ if (IsOnTopScreen())
+ SetActive(m_wasActive);
+ else
+ {
+ bool wasActive = (m_wasActive | m_active);
+ SetActive(false);
+ m_wasActive = wasActive;
+ }
+}
+
+/// is our containing screen the top screen?
+bool MythUIWebBrowser::IsOnTopScreen(void)
+{
+ if (!m_parentScreen)
+ return false;
- // is our containing screen the top screen?
for (int x = GetMythMainWindow()->GetStackCount() - 1; x >= 0; x--)
{
MythScreenStack *stack = GetMythMainWindow()->GetStackAt(x);
@@ -1363,19 +1396,10 @@ void MythUIWebBrowser::slotTopScreenChanged(MythScreenType *screen)
if (!stack->GetTopScreen())
continue;
- if (stack->GetTopScreen() == m_parentScreen)
- {
- SetActive(m_wasActive);
- break;
- }
- else
- {
- bool wasActive = (m_wasActive | m_active);
- SetActive(false);
- m_wasActive = wasActive;
- break;
- }
+ return (stack->GetTopScreen() == m_parentScreen);
}
+
+ return false;
}
@@ -214,6 +214,8 @@ class MUI_PUBLIC MythUIWebBrowser : public MythUIType
void slotIconChanged(void);
void slotLinkClicked(const QUrl &url);
void slotTopScreenChanged(MythScreenType *screen);
+ void slotScrollBarShowing(void);
+ void slotScrollBarHiding(void);
protected:
void Finalize(void);
@@ -222,6 +224,7 @@ class MUI_PUBLIC MythUIWebBrowser : public MythUIType
void SetBackgroundColor(QColor color);
void ResetScrollBars(void);
void UpdateScrollBars(void);
+ bool IsOnTopScreen(void);
virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset,
int alphaMod, QRect clipRegion);

0 comments on commit 4b66f82

Please sign in to comment.