Skip to content

Commit

Permalink
CDockAreaTitleBar::resizeEvent function to fix issue #656
Browse files Browse the repository at this point in the history
  • Loading branch information
githubuser0xFFFF committed Dec 12, 2024
1 parent 1f21eb0 commit e2f611e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 10 additions & 3 deletions examples/emptydockarea/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ CMainWindow::CMainWindow(QWidget *parent)
, ui(new Ui::CMainWindow)
{
ui->setupUi(this);
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasCloseButton, false );
ads::CDockManager::setConfigFlag( ads::CDockManager::AllTabsHaveCloseButton, 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);

// Set central widget
Expand Down Expand Up @@ -98,8 +100,13 @@ void CMainWindow::createPerspectiveUi()
PerspectiveComboBox = new QComboBox(this);
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
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&)),
DockManager, SLOT(openPerspective(const QString&)));
#endif
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
ui->toolBar->addSeparator();
ui->toolBar->addAction(PerspectiveListAction);
Expand Down
5 changes: 4 additions & 1 deletion src/DockAreaTitleBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ void CDockAreaTitleBar::resizeEvent(QResizeEvent *event)
if (CDockManager::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility)
&& 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);
}
}

Expand Down

0 comments on commit e2f611e

Please sign in to comment.