mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
Merge pull request #8 from Opostol/master
DockWidgetClosable now prevents Floating Dock Windows from closing
This commit is contained in:
commit
f5b3c0556d
@ -300,16 +300,20 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
std::cout << "closeEvent" << std::endl;
|
qDebug() << "CFloatingDockContainer closeEvent";
|
||||||
d->setDraggingActive(false);
|
d->setDraggingActive(false);
|
||||||
|
|
||||||
|
if (isClosable())
|
||||||
QWidget::closeEvent(event);
|
QWidget::closeEvent(event);
|
||||||
|
else
|
||||||
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
||||||
{
|
{
|
||||||
std::cout << "hideEvent" << std::endl;
|
qDebug() << "CFloatingDockContainer hideEvent";
|
||||||
QWidget::hideEvent(event);
|
QWidget::hideEvent(event);
|
||||||
auto OpenDockAreas = d->DockContainer->openedDockAreas();
|
auto OpenDockAreas = d->DockContainer->openedDockAreas();
|
||||||
for (auto DockArea : OpenDockAreas)
|
for (auto DockArea : OpenDockAreas)
|
||||||
@ -408,6 +412,21 @@ void CFloatingDockContainer::moveFloating()
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
bool CFloatingDockContainer::isClosable()
|
||||||
|
{
|
||||||
|
auto OpenDockAreas = d->DockContainer->openedDockAreas();
|
||||||
|
for (auto DockArea : OpenDockAreas)
|
||||||
|
{
|
||||||
|
auto OpenDockWidgets = DockArea->openedDockWidgets();
|
||||||
|
for (auto DockWidget : OpenDockWidgets)
|
||||||
|
{
|
||||||
|
if (!(DockWidget->features() & CDockWidget::DockWidgetClosable))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
||||||
{
|
{
|
||||||
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
|
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
|
||||||
|
@ -55,6 +55,8 @@ private:
|
|||||||
FloatingDockContainerPrivate* d; ///< private data (pimpl)
|
FloatingDockContainerPrivate* d; ///< private data (pimpl)
|
||||||
friend struct FloatingDockContainerPrivate;
|
friend struct FloatingDockContainerPrivate;
|
||||||
|
|
||||||
|
bool isClosable();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDockAreasAddedOrRemoved();
|
void onDockAreasAddedOrRemoved();
|
||||||
void onDockAreaCurrentChanged(int Index);
|
void onDockAreaCurrentChanged(int Index);
|
||||||
|
Loading…
Reference in New Issue
Block a user