mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 07:21:32 +08:00
Fixed #420 - Floating docks title doesn't update
added tests for DockWidget->setWindowTitle() in demo application
This commit is contained in:
parent
23f80334f6
commit
0e566cb8a3
@ -433,6 +433,7 @@ void MainWindowPrivate::createContent()
|
||||
int Width = Splitter->width();
|
||||
Splitter->setSizes({Width * 2/3, Width * 1/3});
|
||||
});
|
||||
DockWidget->setWindowTitle(QString("My " + DockWidget->windowTitle()));
|
||||
|
||||
// Now we add a custom button to the dock area title bar that will create
|
||||
// new editor widgets when clicked
|
||||
@ -474,6 +475,7 @@ void MainWindowPrivate::createContent()
|
||||
// Test visible floating dock widget
|
||||
DockWidget = createCalendarDockWidget();
|
||||
DockManager->addDockWidgetFloating(DockWidget);
|
||||
DockWidget->setWindowTitle(QString("My " + DockWidget->windowTitle()));
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -51,6 +51,7 @@ class CFloatingDragPreview;
|
||||
struct FloatingDragPreviewPrivate;
|
||||
class CDockingStateReader;
|
||||
|
||||
|
||||
/**
|
||||
* Container that manages a number of dock areas with single dock widgets
|
||||
* or tabyfied dock widgets in each area.
|
||||
|
@ -456,6 +456,14 @@ CDockContainerWidget* CDockWidget::dockContainer() const
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CFloatingDockContainer* CDockWidget::floatingDockContainer() const
|
||||
{
|
||||
auto DockContainer = dockContainer();
|
||||
return DockContainer ? DockContainer->floatingWidget() : nullptr;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CDockAreaWidget* CDockWidget::dockAreaWidget() const
|
||||
{
|
||||
@ -670,6 +678,12 @@ bool CDockWidget::event(QEvent *e)
|
||||
{
|
||||
d->DockArea->markTitleBarMenuOutdated();//update tabs menu
|
||||
}
|
||||
|
||||
auto FloatingWidget = floatingDockContainer();
|
||||
if (FloatingWidget)
|
||||
{
|
||||
FloatingWidget->updateWindowTitle();
|
||||
}
|
||||
Q_EMIT titleChanged(title);
|
||||
}
|
||||
break;
|
||||
|
@ -331,6 +331,12 @@ public:
|
||||
*/
|
||||
CDockContainerWidget* dockContainer() const;
|
||||
|
||||
/**
|
||||
* This function return the floating DockContainer if is isFloating() is true
|
||||
* and a nullptr if this dock widget is not floating.
|
||||
*/
|
||||
CFloatingDockContainer* floatingDockContainer() const;
|
||||
|
||||
/**
|
||||
* Returns the dock area widget this dock widget belongs to or 0
|
||||
* if this dock widget has not been docked yet
|
||||
|
Loading…
Reference in New Issue
Block a user