diff options
| author | Felix Ernst <[email protected]> | 2024-03-13 15:39:00 +0000 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2024-03-13 15:39:00 +0000 |
| commit | f588a7d48b7cef5351d8b0f030a6ec5e76229976 (patch) | |
| tree | 086c0743d3dd63e5ca11cd84e55b527f58cbe5ea /src/dolphinviewcontainer.cpp | |
| parent | 73ea5fd8450cdd097a47ede9d740cbbcf9f9df10 (diff) | |
Animate most of the bars
When a bar is toggled visible this usually happens because the
user might want to use its functionality now. However, if bars
appear without animation or at a location the user is not
currently looking at, they might not notice that they have appeared
at all.
An animation makes it more likely that the user notices the change
and can then use the newly made visible component.
Another reason for animations for showing or hiding of components
is that it can be disorienting for users when panels or bars
suddenly appear or disappear without animation. There is no visible
movement then, so the user might not know what happened if they
didn't concentrate or blink at that moment. The newly appearing or
disappearing component might also displace other components which
can make it difficult to find what one was just looking at.
These bars animate now after this change:
- Search panel
- Filter bar
- Status bar
This is implemented by extracting the animation code from
SelectionMode::TopBar into a new abstract base class
AnimatedHeightWidget. This class is now also used in
SelectionMode::BottomBar and the animating code there was removed.
These bars are left in Dolphin that stay without animation:
- Menu bar (Would probably need to be implemented in KXmlGui)
- Tool bar (Would probably need to be implemented in KXmlGui)
- Tab bar (Needs a different appraoch because it already inherits
QTabBar and therefore can not inherit AnimatedHeightWidget)
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index ecabbc379..cf7778c82 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -79,7 +79,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl &url, QWidget *parent) m_topLayout->setContentsMargins(0, 0, 0, 0); m_searchBox = new DolphinSearchBox(this); - m_searchBox->hide(); + m_searchBox->setVisible(false, WithoutAnimation); connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate); connect(m_searchBox, &DolphinSearchBox::openRequest, this, &DolphinViewContainer::openSearchBox); connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox); @@ -112,7 +112,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl &url, QWidget *parent) // Initialize filter bar m_filterBar = new FilterBar(this); - m_filterBar->setVisible(GeneralSettings::filterBar()); + m_filterBar->setVisible(GeneralSettings::filterBar(), WithoutAnimation); connect(m_filterBar, &FilterBar::filterChanged, this, &DolphinViewContainer::setNameFilter); connect(m_filterBar, &FilterBar::closeRequest, this, &DolphinViewContainer::closeFilterBar); @@ -330,7 +330,8 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti m_selectionModeBottomBar->setVisible(false, WithAnimation); Q_EMIT selectionModeChanged(false); - if (m_selectionModeTopBar->isAncestorOf(QApplication::focusWidget()) || m_selectionModeBottomBar->isAncestorOf(QApplication::focusWidget())) { + if (!QApplication::focusWidget() || m_selectionModeTopBar->isAncestorOf(QApplication::focusWidget()) + || m_selectionModeBottomBar->isAncestorOf(QApplication::focusWidget())) { m_view->setFocus(); } return; @@ -448,12 +449,12 @@ void DolphinViewContainer::readSettings() bool DolphinViewContainer::isFilterBarVisible() const { - return m_filterBar->isVisible(); + return m_filterBar->isEnabled(); // Gets disabled in AnimatedHeightWidget while animating towards a hidden state. } void DolphinViewContainer::setSearchModeEnabled(bool enabled) { - m_searchBox->setVisible(enabled); + m_searchBox->setVisible(enabled, WithAnimation); if (enabled) { const QUrl &locationUrl = m_urlNavigator->locationUrl(); @@ -585,7 +586,7 @@ void DolphinViewContainer::setFilterBarVisible(bool visible) Q_ASSERT(m_filterBar); if (visible) { m_view->hideToolTip(ToolTipManager::HideBehavior::Instantly); - m_filterBar->show(); + m_filterBar->setVisible(true, WithAnimation); m_filterBar->setFocus(); m_filterBar->selectAll(); } else { |
