Made all focus related code optional - only if FocusStyling flag is enabled

This commit is contained in:
Uwe Kindler 2020-05-23 11:17:31 +02:00
parent 5652c8440e
commit 9aa958e8b0
4 changed files with 25 additions and 13 deletions

View File

@ -571,6 +571,8 @@ CMainWindow::CMainWindow(QWidget *parent) :
// dock widget.
// CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true);
CDockManager::setConfigFlag(CDockManager::FocusStyling, true);
// Now create the dock manager and its content
d->DockManager = new CDockManager(this);

View File

@ -984,6 +984,7 @@ CIconProvider& CDockManager::iconProvider()
//===========================================================================
void CDockManager::onFocusChanged(QWidget* focusedOld, QWidget* focusedNow)
{
std::cout << "CDockManager::onFocusChanged" << std::endl;
Q_UNUSED(focusedOld)
if (!focusedNow)
{

View File

@ -285,8 +285,11 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
setAttribute(Qt::WA_NoMousePropagation, true);
d->DockWidget = DockWidget;
d->createLayout();
if (CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
{
setFocusPolicy(Qt::ClickFocus);
}
}
//============================================================================
CDockWidgetTab::~CDockWidgetTab()
@ -464,6 +467,8 @@ void CDockWidgetTab::setActiveTab(bool active)
bool TabHasCloseButton = (ActiveTabHasCloseButton && active) | AllTabsHaveCloseButton;
d->CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
if (CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
{
bool UpdateFocusStyle = false;
if (active && !hasFocus())
{
@ -479,6 +484,8 @@ void CDockWidgetTab::setActiveTab(bool active)
}
return;
}
}
d->IsActiveTab = active;
updateStyle();
update();

View File

@ -57,6 +57,7 @@
namespace ads
{
#ifdef Q_OS_WIN
#if 0
/**
* Just for debuging to convert windows message identifiers to strings
*/
@ -350,6 +351,7 @@ static const char* windowsMessageString(int MessageId)
return "unknown WM_ message";
}
#endif
#endif
static unsigned int zOrderCounter = 0;