Skip to content
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
2 changes: 1 addition & 1 deletion include/SubWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class LMMS_EXPORT SubWindow : public QMdiSubWindow
public slots:
void detach();
void attach();
void setVisible(bool visible) override;

protected:
// hook the QWidget move/resize events to update the tracked geometry
void moveEvent( QMoveEvent * event ) override;
void resizeEvent( QResizeEvent * event ) override;
void paintEvent( QPaintEvent * pe ) override;
void changeEvent( QEvent * event ) override;
void showEvent(QShowEvent* event) override;
bool eventFilter(QObject* obj, QEvent* event) override;

bool isDetached() const;
Expand Down
4 changes: 3 additions & 1 deletion src/gui/DetachableWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@

#include "GuiApplication.h"
#include "MainWindow.h"
#include "SubWindow.h"

namespace lmms::gui {

void DetachableWidget::closeEvent(QCloseEvent* ce)
{
if (windowFlags().testFlag(Qt::Window))
{
ce->accept();
dynamic_cast<SubWindow&>(*parentWidget()).attach();
ce->ignore();
}
else if (getGUI()->mainWindow()->workspace())
{
Expand Down
4 changes: 3 additions & 1 deletion src/gui/DetachableWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@

#include "GuiApplication.h"
#include "MainWindow.h"
#include "SubWindow.h"

namespace lmms::gui {

void DetachableWindow::closeEvent(QCloseEvent* ce)
{
if (windowFlags().testFlag(Qt::Window))
{
ce->accept();
dynamic_cast<SubWindow&>(*parentWidget()).attach();
ce->ignore();
}
else if (getGUI()->mainWindow()->workspace())
{
Expand Down
12 changes: 9 additions & 3 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,16 @@ void SubWindow::changeEvent( QEvent *event )

}

void SubWindow::showEvent(QShowEvent* e)
void SubWindow::setVisible(bool visible)
{
attach();
QMdiSubWindow::showEvent(e);
if (isDetached() && visible) // avoid showing titlebar here
{
widget()->show();
// raise the detached window in case it was minimized
widget()->setWindowState((widget()->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
return;
}
QMdiSubWindow::setVisible(visible);
}

bool SubWindow::isDetached() const
Expand Down
Loading