Skip to content

Commit ef5b22c

Browse files
Merge branch 'master' into focus_changed_fix
2 parents 2de3e7e + 42161c8 commit ef5b22c

File tree

7 files changed

+193
-156
lines changed

7 files changed

+193
-156
lines changed

demo/MainWindow.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ struct MainWindowPrivate
165165
QWidgetAction* PerspectiveListAction = nullptr;
166166
QComboBox* PerspectiveComboBox = nullptr;
167167
ads::CDockManager* DockManager = nullptr;
168+
ads::CDockWidget* WindowTitleTestDockWidget = nullptr;
168169

169170
MainWindowPrivate(CMainWindow* _public) : _this(_public) {}
170171

@@ -382,6 +383,7 @@ void MainWindowPrivate::createContent()
382383
}
383384

384385
DockWidget = createLongTextLabelDockWidget();
386+
WindowTitleTestDockWidget = DockWidget;
385387
DockWidget->setFeature(ads::CDockWidget::DockWidgetFocusable, false);
386388
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
387389
auto FileSystemWidget = createFileSystemTreeDockWidget();
@@ -496,6 +498,9 @@ void MainWindowPrivate::createActions()
496498
ui.menuTests->addSeparator();
497499
a = ui.menuTests->addAction("Show Status Dialog");
498500
_this->connect(a, SIGNAL(triggered()), SLOT(showStatusDialog()));
501+
502+
a = ui.menuTests->addAction("Toggle Label 0 Window Title");
503+
_this->connect(a, SIGNAL(triggered()), SLOT(toggleDockWidgetWindowTitle()));
499504
ui.menuTests->addSeparator();
500505
}
501506

@@ -745,3 +750,20 @@ void CMainWindow::showStatusDialog()
745750
Dialog.exec();
746751
}
747752

753+
754+
//============================================================================
755+
void CMainWindow::toggleDockWidgetWindowTitle()
756+
{
757+
QString Title = d->WindowTitleTestDockWidget->windowTitle();
758+
int i = Title.indexOf(" (Test)");
759+
if (-1 == i)
760+
{
761+
Title += " (Test)";
762+
}
763+
else
764+
{
765+
Title = Title.left(i);
766+
}
767+
d->WindowTitleTestDockWidget->setWindowTitle(Title);
768+
}
769+

demo/MainWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ private slots:
6464
void createTable();
6565
void onEditorCloseRequested();
6666
void showStatusDialog();
67+
void toggleDockWidgetWindowTitle();
6768
};
6869

6970
#endif // MAINWINDOW_H

demo/demo.py

Lines changed: 158 additions & 155 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ def _sip_sipfiles_dir(self):
168168
return os.path.join(sys.prefix, 'sip', 'PyQt5')
169169

170170
def _sip_compile(self, sip_bin, source, sbf):
171-
pyi = os.path.join(self.build_lib, "PyQtAds", "QtAds", "ads.pyi")
171+
target_dir = os.path.dirname(__file__) if self.inplace else self.build_lib
172+
pyi = os.path.join(target_dir, "PyQtAds", "QtAds", "ads.pyi")
173+
if not os.path.exists(os.path.dirname(pyi)):
174+
os.makedirs(os.path.dirname(pyi))
175+
172176
cmd = [sip_bin]
173177
if hasattr(self, 'sip_opts'):
174178
cmd += self.sip_opts

sip/DockManager.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public:
169169
FloatingContainerHasWidgetIcon,
170170
HideSingleCentralWidgetTitleBar,
171171
FocusHighlighting,
172+
EqualSplitOnInsertion,
172173
DefaultDockAreaButtons,
173174
DefaultBaseConfig,
174175
DefaultOpaqueConfig,

sip/DockWidget.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public:
3131
DockWidgetFloatable,
3232
DockWidgetDeleteOnClose,
3333
CustomCloseHandling,
34+
DockWidgetFocusable,
3435
DefaultDockWidgetFeatures,
3536
AllDockWidgetFeatures,
3637
NoDockWidgetFeatures

src/DockAreaTabBar.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,11 @@ bool CDockAreaTabBar::eventFilter(QObject *watched, QEvent *event)
456456
updateGeometry();
457457
break;
458458

459+
// Setting the text of a tab will cause a LayoutRequest event
460+
case QEvent::LayoutRequest:
461+
updateGeometry();
462+
break;
463+
459464
default:
460465
break;
461466
}

0 commit comments

Comments
 (0)