mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-24 05:22:06 +08:00
Added setFullScreen(), setNormal() and isFullScreen() function to CDockWidget to be more compatible to QDockWidget
This commit is contained in:
parent
7a17aba42d
commit
1f995299f0
@ -266,6 +266,19 @@ static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
|
||||
DockWidget->setWidget(w);
|
||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||
DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent);
|
||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||
auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen");
|
||||
QObject::connect(Action, &QAction::triggered, [=]()
|
||||
{
|
||||
if (DockWidget->isFullScreen())
|
||||
{
|
||||
DockWidget->showNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
DockWidget->showFullScreen();
|
||||
}
|
||||
});
|
||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||
return DockWidget;
|
||||
}
|
||||
@ -670,3 +683,10 @@ void CMainWindow::createTable()
|
||||
FloatingWidget->move(QPoint(40, 40));
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::onFullscreenActionTriggered()
|
||||
{
|
||||
std::cout << "CMainWindow::onFullscreenActionTriggered()" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ private slots:
|
||||
void createEditor();
|
||||
void createTable();
|
||||
void onEditorCloseRequested();
|
||||
void onFullscreenActionTriggered();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -13,5 +13,6 @@
|
||||
<file>app.css</file>
|
||||
<file>images/plus.svg</file>
|
||||
<file>images/help_outline.svg</file>
|
||||
<file>images/fullscreen.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
6
demo/images/fullscreen.svg
Normal file
6
demo/images/fullscreen.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||
<desc>settings_overscan icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||
<path d="M981.33,213.33v597.34c0,46.93 -38.4,85.33 -85.33,85.33h-768c-46.93,0 -85.33,-38.4 -85.33,-85.33v-597.34c0,-46.93 38.4,-85.33 85.33,-85.33h768c46.93,0 85.33,38.4 85.33,85.33zM896,212.91h-768v598.18h768zM256,597.33l-106.67,-84.9l106.67,-85.76zM597.33,341.33h-170.66l85.76,-106.66zM874.67,512.43l-106.67,84.9v-170.66zM512.43,789.33l-85.76,-106.66h170.66z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 776 B |
@ -876,6 +876,48 @@ QList<QAction*> CDockWidget::titleBarActions() const
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidget::showFullScreen()
|
||||
{
|
||||
if (isFloating())
|
||||
{
|
||||
dockContainer()->floatingWidget()->showFullScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
Super::showFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidget::showNormal()
|
||||
{
|
||||
if (isFloating())
|
||||
{
|
||||
dockContainer()->floatingWidget()->showNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
Super::showFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CDockWidget::isFullScreen() const
|
||||
{
|
||||
if (isFloating())
|
||||
{
|
||||
return dockContainer()->floatingWidget()->isFullScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Super::isFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -449,6 +449,12 @@ public:
|
||||
void setTabToolTip(const QString &text);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns true if the dock widget is floating and if the floating dock
|
||||
* container is full screen
|
||||
*/
|
||||
bool isFullScreen() const;
|
||||
|
||||
public: // reimplements QFrame -----------------------------------------------
|
||||
/**
|
||||
* Emits titleChanged signal if title change event occurs
|
||||
@ -478,6 +484,20 @@ public slots:
|
||||
*/
|
||||
void closeDockWidget();
|
||||
|
||||
/**
|
||||
* Shows the widget in full-screen mode.
|
||||
* Normally this function only affects windows. To make the interface
|
||||
* compatible to QDockWidget, this function also maximizes a floating
|
||||
* dock widget.
|
||||
*/
|
||||
void showFullScreen();
|
||||
|
||||
/**
|
||||
* This function complements showFullScreen() to restore the widget
|
||||
* after it has been in full screen mode.
|
||||
*/
|
||||
void showNormal();
|
||||
|
||||
|
||||
signals:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user