mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Made all focus related code optional - only if FocusStyling flag is enabled
This commit is contained in:
parent
5652c8440e
commit
9aa958e8b0
@ -571,6 +571,8 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
// dock widget.
|
// dock widget.
|
||||||
// CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true);
|
// CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true);
|
||||||
|
|
||||||
|
CDockManager::setConfigFlag(CDockManager::FocusStyling, true);
|
||||||
|
|
||||||
// Now create the dock manager and its content
|
// Now create the dock manager and its content
|
||||||
d->DockManager = new CDockManager(this);
|
d->DockManager = new CDockManager(this);
|
||||||
|
|
||||||
|
@ -984,6 +984,7 @@ CIconProvider& CDockManager::iconProvider()
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CDockManager::onFocusChanged(QWidget* focusedOld, QWidget* focusedNow)
|
void CDockManager::onFocusChanged(QWidget* focusedOld, QWidget* focusedNow)
|
||||||
{
|
{
|
||||||
|
std::cout << "CDockManager::onFocusChanged" << std::endl;
|
||||||
Q_UNUSED(focusedOld)
|
Q_UNUSED(focusedOld)
|
||||||
if (!focusedNow)
|
if (!focusedNow)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,10 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
|
|||||||
setAttribute(Qt::WA_NoMousePropagation, true);
|
setAttribute(Qt::WA_NoMousePropagation, true);
|
||||||
d->DockWidget = DockWidget;
|
d->DockWidget = DockWidget;
|
||||||
d->createLayout();
|
d->createLayout();
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
if (CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
|
||||||
|
{
|
||||||
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -464,21 +467,25 @@ void CDockWidgetTab::setActiveTab(bool active)
|
|||||||
bool TabHasCloseButton = (ActiveTabHasCloseButton && active) | AllTabsHaveCloseButton;
|
bool TabHasCloseButton = (ActiveTabHasCloseButton && active) | AllTabsHaveCloseButton;
|
||||||
d->CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
|
d->CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
|
||||||
|
|
||||||
bool UpdateFocusStyle = false;
|
if (CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
|
||||||
if (active && !hasFocus())
|
|
||||||
{
|
{
|
||||||
setFocus(Qt::OtherFocusReason);
|
bool UpdateFocusStyle = false;
|
||||||
UpdateFocusStyle = true;
|
if (active && !hasFocus())
|
||||||
|
{
|
||||||
|
setFocus(Qt::OtherFocusReason);
|
||||||
|
UpdateFocusStyle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->IsActiveTab == active)
|
||||||
|
{
|
||||||
|
if (UpdateFocusStyle)
|
||||||
|
{
|
||||||
|
updateStyle();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->IsActiveTab == active)
|
|
||||||
{
|
|
||||||
if (UpdateFocusStyle)
|
|
||||||
{
|
|
||||||
updateStyle();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
d->IsActiveTab = active;
|
d->IsActiveTab = active;
|
||||||
updateStyle();
|
updateStyle();
|
||||||
update();
|
update();
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#if 0
|
||||||
/**
|
/**
|
||||||
* Just for debuging to convert windows message identifiers to strings
|
* Just for debuging to convert windows message identifiers to strings
|
||||||
*/
|
*/
|
||||||
@ -350,6 +351,7 @@ static const char* windowsMessageString(int MessageId)
|
|||||||
return "unknown WM_ message";
|
return "unknown WM_ message";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static unsigned int zOrderCounter = 0;
|
static unsigned int zOrderCounter = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user