mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31: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)
|
||||
{
|
||||
std::cout << "closeEvent" << std::endl;
|
||||
qDebug() << "CFloatingDockContainer closeEvent";
|
||||
d->setDraggingActive(false);
|
||||
QWidget::closeEvent(event);
|
||||
|
||||
if (isClosable())
|
||||
QWidget::closeEvent(event);
|
||||
else
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
||||
{
|
||||
std::cout << "hideEvent" << std::endl;
|
||||
qDebug() << "CFloatingDockContainer hideEvent";
|
||||
QWidget::hideEvent(event);
|
||||
auto OpenDockAreas = d->DockContainer->openedDockAreas();
|
||||
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()
|
||||
{
|
||||
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
|
||||
|
@ -55,6 +55,8 @@ private:
|
||||
FloatingDockContainerPrivate* d; ///< private data (pimpl)
|
||||
friend struct FloatingDockContainerPrivate;
|
||||
|
||||
bool isClosable();
|
||||
|
||||
private slots:
|
||||
void onDockAreasAddedOrRemoved();
|
||||
void onDockAreaCurrentChanged(int Index);
|
||||
|
Loading…
Reference in New Issue
Block a user