/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace ScriptCanvasEditor { using namespace AzToolsFramework::AssetBrowser; ////////////////////// // UnitTestTreeView ////////////////////// UnitTestTreeView::UnitTestTreeView(QWidget* parent) : AzToolsFramework::QTreeViewWithStateSaving(parent) , m_filter(new UnitTestBrowserFilterModel(parent)) { AssetBrowserComponentRequestBus::BroadcastResult(m_model, &AssetBrowserComponentRequests::GetAssetBrowserModel); if (!m_model) { AZ_Error("ScriptCanvas", false, "Unable to setup UnitTest TreeView, asset browser model was not provided."); } else { m_filter->setSourceModel(m_model); m_filter->FilterSetup(); setModel(m_filter); QAbstractItemView::setIconSize(QSize(14, 14)); setMouseTracking(true); } } UnitTestTreeView::~UnitTestTreeView() { } void UnitTestTreeView::SetSearchFilter(const QString& filter) { clearSelection(); m_filter->SetSearchFilter(filter); if (!filter.isEmpty()) { expandAll(); } } void UnitTestTreeView::mouseMoveEvent(QMouseEvent* event) { QModelIndex index = indexAt(event->pos()); QModelIndex sourceIndex = m_filter->mapToSource(index); if (sourceIndex.isValid()) { m_filter->SetHoveredIndex(sourceIndex); } else { m_filter->SetHoveredIndex(QModelIndex()); } AzToolsFramework::QTreeViewWithStateSaving::mouseMoveEvent(event); } void UnitTestTreeView::leaveEvent(QEvent* ev) { m_filter->SetHoveredIndex(QModelIndex()); } }