Skip to content

Commit e2f611e

Browse files
CDockAreaTitleBar::resizeEvent function to fix issue #656
1 parent 1f21eb0 commit e2f611e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

examples/emptydockarea/mainwindow.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ CMainWindow::CMainWindow(QWidget *parent)
3232
, ui(new Ui::CMainWindow)
3333
{
3434
ui->setupUi(this);
35-
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
36-
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
37-
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
35+
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasCloseButton, false );
36+
ads::CDockManager::setConfigFlag( ads::CDockManager::AllTabsHaveCloseButton, true );
37+
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasUndockButton, false );
38+
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true );
39+
ads::CDockManager::setConfigFlag( ads::CDockManager::DisableTabTextEliding, true );
3840
DockManager = new CDockManager(this);
3941

4042
// Set central widget
@@ -98,8 +100,13 @@ void CMainWindow::createPerspectiveUi()
98100
PerspectiveComboBox = new QComboBox(this);
99101
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
100102
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
103+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
104+
connect(PerspectiveComboBox, &QComboBox::textActivated,
105+
DockManager, &CDockManager::openPerspective);
106+
#else
101107
connect(PerspectiveComboBox, SIGNAL(activated(const QString&)),
102108
DockManager, SLOT(openPerspective(const QString&)));
109+
#endif
103110
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
104111
ui->toolBar->addSeparator();
105112
ui->toolBar->addAction(PerspectiveListAction);

src/DockAreaTitleBar.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ void CDockAreaTitleBar::resizeEvent(QResizeEvent *event)
385385
if (CDockManager::testConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility)
386386
&& CDockManager::testConfigFlag(CDockManager::DisableTabTextEliding))
387387
{
388-
markTabsMenuOutdated();
388+
// Use queued connection to ensure that the resizing and relayouting has
389+
// finished to ensure that the d->TabBar->areTabsOverflowing() function
390+
// returns the correct value
391+
QMetaObject::invokeMethod(this, "markTabsMenuOutdated", Qt::QueuedConnection);
389392
}
390393
}
391394

0 commit comments

Comments
 (0)