mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Added new CDockManger config flag FocusStyling
This commit is contained in:
parent
26f4c9b049
commit
5652c8440e
@ -540,8 +540,12 @@ CDockManager::CDockManager(QWidget *parent) :
|
||||
d->ContainerOverlay = new CDockOverlay(this, CDockOverlay::ModeContainerOverlay);
|
||||
d->Containers.append(this);
|
||||
d->loadStylesheet();
|
||||
connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)),
|
||||
this, SLOT(onFocusChanged(QWidget*, QWidget*)));
|
||||
|
||||
if (CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
|
||||
{
|
||||
connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)),
|
||||
this, SLOT(onFocusChanged(QWidget*, QWidget*)));
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -1030,7 +1034,7 @@ void CDockManager::onFocusedDockAreaViewToggled(bool Open)
|
||||
return;
|
||||
}
|
||||
|
||||
OpenedDockAreas[0]->currentDockWidget()->tabWidget()->setFocus(Qt::OtherFocusReason);
|
||||
CDockManager::setWidgetFocus(OpenedDockAreas[0]->currentDockWidget()->tabWidget());
|
||||
}
|
||||
|
||||
|
||||
@ -1040,7 +1044,7 @@ void CDockManager::emitWidgetDroppedSignals(QWidget* DroppedWidget)
|
||||
CDockWidget* DockWidget = qobject_cast<CDockWidget*>(DroppedWidget);
|
||||
if (DockWidget)
|
||||
{
|
||||
DockWidget->tabWidget()->setFocus(Qt::OtherFocusReason);
|
||||
CDockManager::setWidgetFocus(DockWidget->tabWidget());
|
||||
emit dockWidgetDropped(DockWidget);
|
||||
return;
|
||||
}
|
||||
@ -1052,7 +1056,7 @@ void CDockManager::emitWidgetDroppedSignals(QWidget* DroppedWidget)
|
||||
}
|
||||
|
||||
DockWidget = DockArea->currentDockWidget();
|
||||
DockWidget->tabWidget()->setFocus(Qt::OtherFocusReason);
|
||||
CDockManager::setWidgetFocus(DockWidget->tabWidget());
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,7 +171,7 @@ public:
|
||||
FloatingContainerHasWidgetIcon = 0x80000, //!< If set, the Floating Widget icon reflects the icon of the current dock widget otherwise it displays application icon
|
||||
HideSingleCentralWidgetTitleBar = 0x100000, //!< If there is only one single visible dock widget in the main dock container (the dock manager) and if this flag is set, then the titlebar of this dock widget will be hidden
|
||||
//!< this only makes sense for non draggable and non floatable widgets and enables the creation of some kind of "central" widget
|
||||
|
||||
FocusStyling = 0x200000, //!< enables styling of focused dock widget tabs or floating widget titlebar
|
||||
|
||||
DefaultDockAreaButtons = DockAreaHasCloseButton
|
||||
| DockAreaHasUndockButton
|
||||
@ -415,6 +415,21 @@ public:
|
||||
*/
|
||||
static int startDragDistance();
|
||||
|
||||
/**
|
||||
* Helper function to set focus depending on the configuration of the
|
||||
* FocusStyling flag
|
||||
*/
|
||||
template <class QWidgetPtr>
|
||||
static void setWidgetFocus(QWidgetPtr widget)
|
||||
{
|
||||
if (!CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
widget->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Opens the perspective with the given name.
|
||||
|
@ -258,6 +258,7 @@ void setButtonIcon(QAbstractButton* Button, QStyle::StandardPixmap StandarPixmap
|
||||
*/
|
||||
void repolishStyle(QWidget* w);
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace ads
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user