Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDE] Fix detached docklet visibility bug #3660

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions editors/sc-ide/widgets/util/docklet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ void Docklet::toggleFloating()

void Docklet::toggleDetached()
{
setDetached( !isDetached() );
setDetachedAndVisible( !isDetached(), this->isVisible() );
}

void Docklet::setDetached( bool detach )
void Docklet::setDetachedAndVisible( bool detach, bool visible )
{
if (isDetached() == detach)
return;
Expand All @@ -226,11 +226,15 @@ void Docklet::setDetached( bool detach )

QWidget *container = currentContainer();

container->show();
// NOTE: Only call show() if the docklet is set to visible otherwise we might
// get into some timing issue where show() can be called after setVisible(false)
// https://github.com/supercollider/supercollider/issues/3287
if (visible)
container->show();

// NOTE: set geometry after show() or else some geometry modifying events
// are postponed!
qDebug() << (detach ? "win:" : "dock:") << "set geom (setDetached):" << undockedGeom << this;
qDebug() << (detach ? "win:" : "dock:") << "set geom (setDetachedAndVisible):" << undockedGeom << this;
if (!undockedGeom.isNull())
container->setGeometry( undockedGeom );

Expand Down Expand Up @@ -291,12 +295,11 @@ void Docklet::restoreDetachedState( const QByteArray & data )
{
if (!data.isEmpty()) {
bool visible = data.at(0) == 1;
setDetached( true );
setDetachedAndVisible( true, visible );
mWindow->restoreGeometry( data.mid(1) );
mWindow->setVisible( visible );
}
else
setDetached( false );
setDetachedAndVisible( false, this->isVisible() );
}

void Docklet::updateDockAction()
Expand Down
2 changes: 1 addition & 1 deletion editors/sc-ide/widgets/util/docklet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Docklet : public QObject
return const_cast<Docklet*>(this)->currentContainer() != mDockWidget;
}

void setDetached( bool detached );
void setDetachedAndVisible( bool detached, bool visible );

bool isVisible() const
{
Expand Down