mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-04-01 02:42:39 +08:00
clazy: pass context object to QObject::connect
This commit is contained in:
parent
d56bf47d39
commit
fe8f205b50
@ -341,7 +341,7 @@ struct MainWindowPrivate
|
|||||||
DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent);
|
DockWidget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContent);
|
||||||
auto ToolBar = DockWidget->createDefaultToolBar();
|
auto ToolBar = DockWidget->createDefaultToolBar();
|
||||||
auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen");
|
auto Action = ToolBar->addAction(svgIcon(":/adsdemo/images/fullscreen.svg"), "Toggle Fullscreen");
|
||||||
QObject::connect(Action, &QAction::triggered, [=]()
|
QObject::connect(Action, &QAction::triggered, DockWidget, [=]()
|
||||||
{
|
{
|
||||||
if (DockWidget->isFullScreen())
|
if (DockWidget->isFullScreen())
|
||||||
{
|
{
|
||||||
@ -419,7 +419,7 @@ void MainWindowPrivate::createContent()
|
|||||||
auto DockArea = DockManager->addDockWidget(ads::CenterDockWidgetArea, DockWidget, TopDockArea);
|
auto DockArea = DockManager->addDockWidget(ads::CenterDockWidgetArea, DockWidget, TopDockArea);
|
||||||
// Now we create a action to test resizing of DockArea widget
|
// Now we create a action to test resizing of DockArea widget
|
||||||
auto Action = ui.menuTests->addAction(QString("Resize %1").arg(DockWidget->windowTitle()));
|
auto Action = ui.menuTests->addAction(QString("Resize %1").arg(DockWidget->windowTitle()));
|
||||||
QObject::connect(Action, &QAction::triggered, [DockArea]()
|
QObject::connect(Action, &QAction::triggered, DockArea, [DockArea]()
|
||||||
{
|
{
|
||||||
// Resizing only works, if the Splitter is visible and has a valid
|
// Resizing only works, if the Splitter is visible and has a valid
|
||||||
// sizes
|
// sizes
|
||||||
@ -445,7 +445,7 @@ void MainWindowPrivate::createContent()
|
|||||||
auto TitleBar = DockArea->titleBar();
|
auto TitleBar = DockArea->titleBar();
|
||||||
int Index = TitleBar->indexOf(TitleBar->tabBar());
|
int Index = TitleBar->indexOf(TitleBar->tabBar());
|
||||||
TitleBar->insertWidget(Index + 1, CustomButton);
|
TitleBar->insertWidget(Index + 1, CustomButton);
|
||||||
QObject::connect(CustomButton, &QToolButton::clicked, [=]()
|
QObject::connect(CustomButton, &QToolButton::clicked, DockArea, [=]()
|
||||||
{
|
{
|
||||||
auto DockWidget = createEditorWidget();
|
auto DockWidget = createEditorWidget();
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);
|
||||||
@ -464,7 +464,7 @@ void MainWindowPrivate::createContent()
|
|||||||
|
|
||||||
// Tests CustomCloseHandling without DeleteOnClose
|
// Tests CustomCloseHandling without DeleteOnClose
|
||||||
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||||
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]()
|
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, LabelDockWidget, [LabelDockWidget, this]()
|
||||||
{
|
{
|
||||||
int Result = QMessageBox::question(_this, "Custom Close Request",
|
int Result = QMessageBox::question(_this, "Custom Close Request",
|
||||||
"Do you really want to close this dock widget?");
|
"Do you really want to close this dock widget?");
|
||||||
|
@ -35,7 +35,7 @@ int main(int argc, char *argv[])
|
|||||||
ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true);
|
ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true);
|
||||||
auto dockManager = new ads::CDockManager(&w);
|
auto dockManager = new ads::CDockManager(&w);
|
||||||
w.setDockManager(dockManager);
|
w.setDockManager(dockManager);
|
||||||
QObject::connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, [] (ads::CDockWidget* old, ads::CDockWidget* now) {
|
QObject::connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, [](ads::CDockWidget* old, ads::CDockWidget* now) {
|
||||||
static int Count = 0;
|
static int Count = 0;
|
||||||
qDebug() << Count++ << " CDockManager::focusedDockWidgetChanged old: " << (old ? old->objectName() : "-") << " now: " << now->objectName() << " visible: " << now->isVisible();
|
qDebug() << Count++ << " CDockManager::focusedDockWidgetChanged old: " << (old ? old->objectName() : "-") << " now: " << now->objectName() << " visible: " << now->isVisible();
|
||||||
now->widget()->setFocus();
|
now->widget()->setFocus();
|
||||||
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
|||||||
action = new QAction("Toggle [DeleteContentOnClose]", &w);
|
action = new QAction("Toggle [DeleteContentOnClose]", &w);
|
||||||
w.menuBar()->addAction(action);
|
w.menuBar()->addAction(action);
|
||||||
|
|
||||||
QObject::connect(action, &QAction::triggered, [dw]() {
|
QObject::connect(action, &QAction::triggered, dw, [dw]() {
|
||||||
dw->toggleView(dw->isClosed());
|
dw->toggleView(dw->isClosed());
|
||||||
qDebug() << QString("dock widget %1! contents widget %2!").arg(dw->isClosed() ? "closed" : "open", dw->widget() ? "created" : "deleted");
|
qDebug() << QString("dock widget %1! contents widget %2!").arg(dw->isClosed() ? "closed" : "open", dw->widget() ? "created" : "deleted");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user