mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
Fixed hiding and showing of close button for tab group, added support for removing perspectives
This commit is contained in:
parent
71f66ea6dc
commit
87e3777e37
@ -9,11 +9,15 @@ CONFIG *= c++14
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
MainWindow.cpp
|
||||
MainWindow.cpp \
|
||||
mhtabbar.cpp \
|
||||
mhtabwidget.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
MainWindow.h
|
||||
MainWindow.h \
|
||||
mhtabbar.h \
|
||||
mhtabwidget.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
@ -261,10 +261,12 @@ void DockContainerWidgetPrivate::onVisibleDockAreaCountChanged()
|
||||
{
|
||||
this->TopLevelDockArea = TopLevelDockArea;
|
||||
TopLevelDockArea->titleBarButton(TitleBarButtonUndock)->setVisible(false || !_this->isFloating());
|
||||
TopLevelDockArea->titleBarButton(TitleBarButtonClose)->setVisible(false || !_this->isFloating());
|
||||
}
|
||||
else if (this->TopLevelDockArea)
|
||||
{
|
||||
this->TopLevelDockArea->titleBarButton(TitleBarButtonUndock)->setVisible(true);
|
||||
this->TopLevelDockArea->titleBarButton(TitleBarButtonClose)->setVisible(true);
|
||||
this->TopLevelDockArea = nullptr;
|
||||
}
|
||||
}
|
||||
@ -416,6 +418,7 @@ void DockContainerWidgetPrivate::addDockAreasToList(const QList<CDockAreaWidget*
|
||||
for (auto DockArea : NewDockAreas)
|
||||
{
|
||||
DockArea->titleBarButton(TitleBarButtonUndock)->setVisible(true);
|
||||
DockArea->titleBarButton(TitleBarButtonClose)->setVisible(true);
|
||||
}
|
||||
|
||||
// We need to ensure, that the dock area title bar is visible. The title bar
|
||||
|
@ -515,6 +515,7 @@ QByteArray CDockManager::saveState(eXmlMode XmlMode, int version) const
|
||||
//============================================================================
|
||||
bool CDockManager::restoreState(const QByteArray &state, int version)
|
||||
{
|
||||
std::cout << "CDockManager::restoreState-----------------------" << std::endl;
|
||||
QElapsedTimer Timer;
|
||||
Timer.start();
|
||||
|
||||
@ -586,12 +587,19 @@ CDockAreaWidget* CDockManager::addDockWidgetTabToArea(CDockWidget* Dockwidget,
|
||||
|
||||
|
||||
//============================================================================
|
||||
CDockWidget* CDockManager::findDockWidget(const QString& ObjectName)
|
||||
CDockWidget* CDockManager::findDockWidget(const QString& ObjectName) const
|
||||
{
|
||||
return d->DockWidgetsMap.value(ObjectName, nullptr);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
QMap<QString, CDockWidget*> CDockManager::dockWidgetsMap() const
|
||||
{
|
||||
return d->DockWidgetsMap;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockManager::addPerspective(const QString& UniquePrespectiveName)
|
||||
{
|
||||
@ -600,6 +608,32 @@ void CDockManager::addPerspective(const QString& UniquePrespectiveName)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockManager::removePerspective(const QString& Name)
|
||||
{
|
||||
if (d->Perspectives.remove(Name))
|
||||
{
|
||||
emit perspectiveListChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockManager::removePerspectives(const QStringList& Names)
|
||||
{
|
||||
int Count = 0;
|
||||
for (auto Name : Names)
|
||||
{
|
||||
Count += d->Perspectives.remove(Name);
|
||||
}
|
||||
|
||||
if (Count)
|
||||
{
|
||||
emit perspectiveListChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
QStringList CDockManager::perspectiveNames() const
|
||||
{
|
||||
|
@ -189,7 +189,13 @@ public:
|
||||
* \return Return the found dock widget or nullptr if a dock widget with the
|
||||
* given name is not registered
|
||||
*/
|
||||
CDockWidget* findDockWidget(const QString& ObjectName);
|
||||
CDockWidget* findDockWidget(const QString& ObjectName) const;
|
||||
|
||||
/**
|
||||
* This function returns a readable reference to the internal dock
|
||||
* widgets map so that it is possible to iterate over all dock widgets
|
||||
*/
|
||||
QMap<QString, CDockWidget*> dockWidgetsMap() const;
|
||||
|
||||
/**
|
||||
* Returns the list of all active and visible dock containers
|
||||
@ -237,6 +243,16 @@ public:
|
||||
*/
|
||||
void addPerspective(const QString& UniquePrespectiveName);
|
||||
|
||||
/**
|
||||
* Removes the perspective with the given name from the list of perspectives
|
||||
*/
|
||||
void removePerspective(const QString& Name);
|
||||
|
||||
/**
|
||||
* Removes the given perspectives from the dock manager
|
||||
*/
|
||||
void removePerspectives(const QStringList& Names);
|
||||
|
||||
/**
|
||||
* Returns the names of all available perspectives
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user