Qt-Advanced-Docking-System icon indicating copy to clipboard operation
Qt-Advanced-Docking-System copied to clipboard

Setting toolbar icon size has no affect on toolbar apperance

Open k12Sergey opened this issue 1 year ago • 1 comments

Hi. Im trying to apply icon size for CDockWidget view in toolbar with the following code:

ads::CDockWidget* DockWidget = new ads::CDockWidget(plugin->name());
DockWidget->setWidget(plugin);

DockWidget->setIcon(plugin->icon());        

DockWidget->setToolBarIconSize(QSize(60, 60), ads::CDockWidget::StateHidden);

const auto autoHideContainer = _DockManager->addAutoHideDockWidget(ads::SideBarLocation::SideBarLeft, DockWidget);

But nothing happened with icon in hide toolbar (default icon size is used) (im trying all the available states)

And it even reset to default when addAutoHideDockWidget call. Im also try to apply size after addAutoHideDockWidget but still no effect.

k12Sergey avatar Aug 17 '24 21:08 k12Sergey

i found out that AutoHide widget is a custom internal class, so simple way is to take DockWidget icon size setting (its wrong way because it a common sidebar setting). But still cant found out the way toolBarIconSize should work (which scenario this option is used)

void CAutoHideTab::setDockWidget(CDockWidget* DockWidget)
{
	if (!DockWidget)
	{
		return;
	}
	d->DockWidget = DockWidget;
	setText(DockWidget->windowTitle());
	setIcon(d->DockWidget->icon());
        setIconSize(d->DockWidget->toolBarIconSize(CDockWidget::StateHidden)); // icon setting
	setToolTip(DockWidget->windowTitle());
}

k12Sergey avatar Aug 17 '24 23:08 k12Sergey

Have you choosen the right toolbar style source? You can set the toolba style source of a dockwidget this way:

DockWidget->setToolBarStyleSource(CDockWidget::ToolBarStyleFromDockWidget);

This ensures that the dock widget uses the icon scie ste via d->DockWidget->toolBarIconSize(). If you use this function the states StateFloating and StateDocked are supported.

githubuser0xFFFF avatar Dec 12 '24 14:12 githubuser0xFFFF