CDockAreaTitleBar::resizeEvent function to fix issue #656

This commit is contained in:
Uwe Kindler 2024-12-12 14:53:24 +01:00
parent 1f21eb0200
commit e2f611ea9a
2 changed files with 14 additions and 4 deletions

View File

@ -32,9 +32,11 @@ CMainWindow::CMainWindow(QWidget *parent)
, ui(new Ui::CMainWindow) , ui(new Ui::CMainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true); ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasCloseButton, false );
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false); ads::CDockManager::setConfigFlag( ads::CDockManager::AllTabsHaveCloseButton, true );
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasUndockButton, false );
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true );
ads::CDockManager::setConfigFlag( ads::CDockManager::DisableTabTextEliding, true );
DockManager = new CDockManager(this); DockManager = new CDockManager(this);
// Set central widget // Set central widget
@ -98,8 +100,13 @@ void CMainWindow::createPerspectiveUi()
PerspectiveComboBox = new QComboBox(this); PerspectiveComboBox = new QComboBox(this);
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(PerspectiveComboBox, &QComboBox::textActivated,
DockManager, &CDockManager::openPerspective);
#else
connect(PerspectiveComboBox, SIGNAL(activated(const QString&)), connect(PerspectiveComboBox, SIGNAL(activated(const QString&)),
DockManager, SLOT(openPerspective(const QString&))); DockManager, SLOT(openPerspective(const QString&)));
#endif
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox); PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
ui->toolBar->addSeparator(); ui->toolBar->addSeparator();
ui->toolBar->addAction(PerspectiveListAction); ui->toolBar->addAction(PerspectiveListAction);

View File

@ -385,7 +385,10 @@ void CDockAreaTitleBar::resizeEvent(QResizeEvent *event)
if (CDockManager::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility) if (CDockManager::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility)
&& CDockManager::testConfigFlag(CDockManager::DisableTabTextEliding)) && CDockManager::testConfigFlag(CDockManager::DisableTabTextEliding))
{ {
markTabsMenuOutdated(); // Use queued connection to ensure that the resizing and relayouting has
// finished to ensure that the d->TabBar->areTabsOverflowing() function
// returns the correct value
QMetaObject::invokeMethod(this, "markTabsMenuOutdated", Qt::QueuedConnection);
} }
} }