mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 15:41:34 +08:00
Experimental implementation of close request
This commit is contained in:
parent
25e8d8691f
commit
0305d8a221
@ -494,7 +494,8 @@ void CDockAreaWidget::onTabCloseRequested(int Index)
|
|||||||
auto* DockWidget = dockWidget(Index);
|
auto* DockWidget = dockWidget(Index);
|
||||||
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
||||||
{
|
{
|
||||||
DockWidget->deleteDockWidget();
|
//DockWidget->deleteDockWidget();
|
||||||
|
DockWidget->closeDockWidget();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "DockWidgetTab.h"
|
#include "DockWidgetTab.h"
|
||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
@ -745,6 +747,42 @@ void CDockWidget::deleteDockWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool CDockWidget::handleCloseRequest()
|
||||||
|
{
|
||||||
|
std::cout << "CDockWidget::handleCloseRequest()" << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidget::closeDockWidget()
|
||||||
|
{
|
||||||
|
closeDockWidgetInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
bool CDockWidget::closeDockWidgetInternal()
|
||||||
|
{
|
||||||
|
if (features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
||||||
|
{
|
||||||
|
if (handleCloseRequest())
|
||||||
|
{
|
||||||
|
deleteDockWidget();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toggleView(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -135,6 +135,12 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void toggleViewInternal(bool Open);
|
void toggleViewInternal(bool Open);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal close dock widget implementation.
|
||||||
|
* The function returns true if the dock widget has been closed or hidden
|
||||||
|
*/
|
||||||
|
bool closeDockWidgetInternal();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = QFrame;
|
using Super = QFrame;
|
||||||
|
|
||||||
@ -426,6 +432,12 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void deleteDockWidget();
|
void deleteDockWidget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the dock widget
|
||||||
|
*/
|
||||||
|
void closeDockWidget();
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* This signal is emitted if the dock widget is opened or closed
|
* This signal is emitted if the dock widget is opened or closed
|
||||||
|
@ -133,7 +133,7 @@ public:
|
|||||||
void setText(const QString& title);
|
void setText(const QString& title);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns true if the assigned dock widget is closeable
|
* This function returns true if the assigned dock widget is closable
|
||||||
*/
|
*/
|
||||||
bool isClosable() const;
|
bool isClosable() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user