Asset Browser Search View Column Resizing (#4087)
* Added resizing Signed-off-by: igarri <igarri@amazon.com> * Added Signals and Slots for resizing columns Signed-off-by: igarri <igarri@amazon.com> * Cleaned up code Signed-off-by: igarri <igarri@amazon.com> * Fixed Column Resize when docking Signed-off-by: igarri <igarri@amazon.com> * Added constants Signed-off-by: igarri <igarri@amazon.com> * Applied Code review feedback Signed-off-by: igarri <igarri@amazon.com> * aplied more feedback Signed-off-by: igarri <igarri@amazon.com> * Addressed Code Review Comments Signed-off-by: igarri <igarri@amazon.com> * Fixing bad merge Signed-off-by: igarri <igarri@amazon.com> * Added fix in initialization Signed-off-by: igarri <igarri@amazon.com> * Changed header setup sequence Signed-off-by: igarri <igarri@amazon.com>
This commit is contained in:
@@ -141,6 +141,10 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
|
||||
m_ui->m_assetBrowserTreeViewWidget, &AzAssetBrowser::AssetBrowserTreeView::ClearTypeFilter, m_ui->m_searchWidget,
|
||||
&AzAssetBrowser::SearchWidget::ClearTypeFilter);
|
||||
|
||||
connect(
|
||||
this, &AzAssetBrowserWindow::SizeChangedSignal, m_ui->m_assetBrowserTableViewWidget,
|
||||
&AzAssetBrowser::AssetBrowserTableView::UpdateSizeSlot);
|
||||
|
||||
m_ui->m_assetBrowserTreeViewWidget->SetName("AssetBrowserTreeView_main");
|
||||
}
|
||||
|
||||
@@ -164,6 +168,25 @@ QObject* AzAssetBrowserWindow::createListenerForShowAssetEditorEvent(QObject* pa
|
||||
return listener;
|
||||
}
|
||||
|
||||
void AzAssetBrowserWindow::resizeEvent(QResizeEvent* resizeEvent)
|
||||
{
|
||||
// leftLayout is the parent of the tableView
|
||||
// rightLayout is the parent of the preview window.
|
||||
// Workaround: When docking windows this event keeps holding the old size of the widgets instead of the new one
|
||||
// but the resizeEvent holds the new size of the whole widget
|
||||
// So we have to save the proportions somehow
|
||||
const QWidget* leftLayout = m_ui->m_leftLayout;
|
||||
const QVBoxLayout* rightLayout = m_ui->m_rightLayout;
|
||||
|
||||
const float oldLeftLayoutWidth = aznumeric_cast<float>(leftLayout->geometry().width());
|
||||
const float oldWidth = aznumeric_cast<float>(leftLayout->geometry().width() + rightLayout->geometry().width());
|
||||
|
||||
const float newWidth = oldLeftLayoutWidth * aznumeric_cast<float>(resizeEvent->size().width()) / oldWidth;
|
||||
|
||||
emit SizeChangedSignal(aznumeric_cast<int>(newWidth));
|
||||
QWidget::resizeEvent(resizeEvent);
|
||||
}
|
||||
|
||||
void AzAssetBrowserWindow::OnInitViewToggleButton()
|
||||
{
|
||||
CreateSwitchViewMenu();
|
||||
|
||||
@@ -53,9 +53,17 @@ public:
|
||||
|
||||
static QObject* createListenerForShowAssetEditorEvent(QObject* parent);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void SizeChangedSignal(int newWidth);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* resizeEvent) override;
|
||||
|
||||
private:
|
||||
void OnInitViewToggleButton();
|
||||
void UpdateDisplayInfo();
|
||||
|
||||
protected slots:
|
||||
void CreateSwitchViewMenu();
|
||||
void SetExpandedAssetBrowserMode();
|
||||
|
||||
Reference in New Issue
Block a user