mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +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);
|
||||
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
||||
{
|
||||
DockWidget->deleteDockWidget();
|
||||
//DockWidget->deleteDockWidget();
|
||||
DockWidget->closeDockWidget();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "DockWidgetTab.h"
|
||||
#include "DockWidget.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QAction>
|
||||
#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
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -135,6 +135,12 @@ protected:
|
||||
*/
|
||||
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:
|
||||
using Super = QFrame;
|
||||
|
||||
@ -426,6 +432,12 @@ public slots:
|
||||
*/
|
||||
void deleteDockWidget();
|
||||
|
||||
/**
|
||||
* Closes the dock widget
|
||||
*/
|
||||
void closeDockWidget();
|
||||
|
||||
|
||||
signals:
|
||||
/**
|
||||
* This signal is emitted if the dock widget is opened or closed
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user