Added minimumSizeHint function to DockWidget to prevent jumping of the height of a dock area when switching between dock widgets, fixed use of findParent function in DockWidget - non current dock widgets do not have a parent so this function will fail

This commit is contained in:
Uwe Kindler
2018-10-15 08:29:30 +02:00
parent 30bbd26d0a
commit ada3d6b3b5
10 changed files with 50 additions and 9 deletions

View File

@@ -291,6 +291,8 @@ void DockAreaWidgetPrivate::createTitleBar()
SLOT(onTabCloseRequested(int)));
_this->connect(tabBar(), SIGNAL(tabBarClicked(int)),
SLOT(setCurrentIndex(int)));
_this->connect(tabBar(), SIGNAL(tabMoved(int, int)),
SLOT(reorderDockWidget(int, int)));
}
@@ -480,7 +482,6 @@ void CDockAreaWidget::setCurrentDockWidget(CDockWidget* DockWidget)
//============================================================================
void CDockAreaWidget::setCurrentIndex(int index)
{
std::cout << "CDockAreaWidget::setCurrentIndex " << index << std::endl;
auto TabBar = d->tabBar();
if (index < 0 || index > (TabBar->count() - 1))
{
@@ -583,6 +584,7 @@ CDockWidget* CDockAreaWidget::dockWidget(int Index) const
//============================================================================
void CDockAreaWidget::reorderDockWidget(int fromIndex, int toIndex)
{
qDebug() << "CDockAreaWidget::reorderDockWidget";
if (fromIndex >= d->ContentsLayout->count() || fromIndex < 0
|| toIndex >= d->ContentsLayout->count() || toIndex < 0 || fromIndex == toIndex)
{
@@ -658,7 +660,7 @@ CDockWidget* CDockAreaWidget::nextOpenDockWidget(CDockWidget* DockWidget) const
//============================================================================
CDockWidget::DockWidgetFeatures CDockAreaWidget::features() const
{
CDockWidget::DockWidgetFeatures Features;
CDockWidget::DockWidgetFeatures Features(CDockWidget::AllDockWidgetFeatures);
for (const auto DockWidget : dockWidgets())
{
Features &= DockWidget->features();
@@ -667,6 +669,20 @@ CDockWidget::DockWidgetFeatures CDockAreaWidget::features() const
return Features;
}
//============================================================================
void CDockAreaWidget::setVisible(bool visible)
{
Super::setVisible(visible);
QString FirstDockWidgetLabel;
if (dockWidgetsCount())
{
FirstDockWidgetLabel = dockWidget(0)->windowTitle();
}
qDebug() << "CDockAreaWidget::setVisible " << visible << " " << FirstDockWidgetLabel
<< " count: " << dockWidgetsCount() << " open count: " << openDockWidgetsCount();
}
} // namespace ads
//---------------------------------------------------------------------------