mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Improved focus styling
This commit is contained in:
parent
9aa958e8b0
commit
ae999f132e
@ -10,6 +10,7 @@ int main(int argc, char *argv[])
|
||||
QApplication a(argc, argv);
|
||||
QMainWindow w;
|
||||
|
||||
ads::CDockManager::setConfigFlag(ads::CDockManager::FocusStyling, true);
|
||||
auto dockManager = new ads::CDockManager(&w);
|
||||
|
||||
QAction *action = new QAction("New Delete On Close", &w);
|
||||
|
@ -1461,6 +1461,12 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
|
||||
}
|
||||
|
||||
window()->activateWindow();
|
||||
if (SingleDroppedDockWidget)
|
||||
{
|
||||
std::cout << "SingleDockWidget dropped" << std::endl;
|
||||
d->DockManager->emitWidgetDroppedSignals(SingleDroppedDockWidget);
|
||||
}
|
||||
d->DockManager->endFloatingWidgetDrop(FloatingWidget);
|
||||
}
|
||||
|
||||
|
||||
|
@ -500,10 +500,16 @@ void DockManagerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
||||
updateDockAreaFocusStyle(FocusedArea, true);
|
||||
QObject::connect(FocusedArea, SIGNAL(viewToggled(bool)), _this, SLOT(onFocusedDockAreaViewToggled(bool)));
|
||||
|
||||
auto NewFloatingWidget = FocusedDockWidget->dockContainer()->floatingWidget();
|
||||
if (NewFloatingWidget)
|
||||
{
|
||||
NewFloatingWidget->setProperty("FocusedDockWidget", QVariant::fromValue(DockWidget));
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// This code is required for styling the floating widget titlebar for linux
|
||||
// depending on the current focus state
|
||||
auto NewFloatingWidget = FocusedDockWidget->dockContainer()->floatingWidget();
|
||||
if (FloatingWidget == NewFloatingWidget)
|
||||
{
|
||||
return;
|
||||
@ -1061,6 +1067,28 @@ void CDockManager::emitWidgetDroppedSignals(QWidget* DroppedWidget)
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
void CDockManager::endFloatingWidgetDrop(CFloatingDockContainer* FloatingWidget)
|
||||
{
|
||||
if (!FloatingWidget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto vDockWidget = FloatingWidget->property("FocusedDockWidget");
|
||||
if (!vDockWidget.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto DockWidget = vDockWidget.value<CDockWidget*>();
|
||||
if (DockWidget)
|
||||
{
|
||||
std::cout << "Dropped focus dock widget " << DockWidget->objectName().toStdString() << std::endl;
|
||||
CDockManager::setWidgetFocus(DockWidget->tabWidget());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -128,6 +128,14 @@ protected:
|
||||
*/
|
||||
void emitWidgetDroppedSignals(QWidget* DroppedWidget);
|
||||
|
||||
/**
|
||||
* This function is called, if a floating widget has been dropped into
|
||||
* an new position.
|
||||
* When this function is called, all dock widgets of the FloatingWidget
|
||||
* are already inserted into its new position
|
||||
*/
|
||||
void endFloatingWidgetDrop(CFloatingDockContainer* FloatingWidget);
|
||||
|
||||
/**
|
||||
* Show the floating widgets that has been created floating
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user