Fix floating window's title bar not being correct
FloatingWindow::hasSingleFrame() was true, but FloatingWindow::frames() returned 2 of them, since frames() is based on child count and it hadn't been reparented yet Not commiting to 1.0 since it touches the layouting engine. All tests pass and testing showed no side effects though, so should be fine for 1.0 too Fixes #74
This commit is contained in:
@@ -177,9 +177,9 @@ void Item::setGuestWidget(Widget *guest)
|
||||
m_guest = guest;
|
||||
|
||||
if (m_guest) {
|
||||
m_guest->setParent(m_hostWidget);
|
||||
m_guest->setLayoutItem(this);
|
||||
newWidget->installEventFilter(this);
|
||||
m_guest->setParent(m_hostWidget);
|
||||
setMinSize(guest->minSize());
|
||||
setMaxSizeHint(guest->maxSizeHint());
|
||||
|
||||
|
||||
@@ -431,6 +431,7 @@ private Q_SLOTS:
|
||||
void tst_setWidget();
|
||||
void tst_isInMainWindow();
|
||||
void tst_titleBarFocusedWhenTabsChange();
|
||||
void tst_floatingWindowTitleBug();
|
||||
|
||||
private:
|
||||
std::unique_ptr<MultiSplitter> createMultiSplitterFromSetup(MultiSplitterSetup setup, QHash<QWidget *, Frame *> &frameMap) const;
|
||||
@@ -5887,6 +5888,29 @@ void TestDocks::tst_titleBarFocusedWhenTabsChange()
|
||||
QVERIFY(!dock1->titleBar()->isFocused());
|
||||
QVERIFY(dock2->titleBar()->isFocused());
|
||||
}
|
||||
void TestDocks::tst_floatingWindowTitleBug()
|
||||
{
|
||||
// Test for #74
|
||||
|
||||
auto dw1 = new DockWidget(QStringLiteral("1"));
|
||||
auto dw2 = new DockWidget(QStringLiteral("2"));
|
||||
auto dw3 = new DockWidget(QStringLiteral("3"));
|
||||
|
||||
dw1->setObjectName(QStringLiteral("1"));
|
||||
dw2->setObjectName(QStringLiteral("2"));
|
||||
dw3->setObjectName(QStringLiteral("3"));
|
||||
|
||||
dw1->show();
|
||||
dw1->addDockWidgetAsTab(dw2);
|
||||
dw1->addDockWidgetToContainingWindow(dw3, Location_OnBottom);
|
||||
|
||||
dw1->titleBar()->onFloatClicked();
|
||||
|
||||
QCOMPARE(dw3->titleBar()->title(), QLatin1String("3"));
|
||||
|
||||
delete dw1->window();
|
||||
delete dw3->window();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user