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

Floating signal bug #79

Closed
nandishnan4 opened this issue Sep 23, 2020 · 2 comments
Closed

Floating signal bug #79

nandishnan4 opened this issue Sep 23, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nandishnan4
Copy link

Hello Sergio,

I added the below code
----------------------------MyWidget.cpp----------------------------
MyWidget::MyWidget(const QString &backgroundFile, const QString &logoFile, QWidget parent)
: QWidget(parent)
{
m_is_floating_checkbox = new QCheckBox(this);
m_label = new QLabel(this);
m_label->setStyleSheet("QLabel { background-color : orange; color : black; }");
m_label->setText("Floating");
QFont f( "Arial", 12, QFont::Bold);
m_label->setFont( f);
m_label->move(20,0);
....
....
....
}
void MyWidget::connectTo(KDDockWidgets::DockWidget
dock) {
connect(dock->floatAction(), &QAction::toggled, m_is_floating_checkbox, &QCheckBox::setChecked);
bool val = dock->floatAction()->isChecked();
m_is_floating_checkbox->setChecked(val);
}
----------------------------MyWidget.h----------------------------
class MyWidget : public QWidget
{
...
...
public:
void connectTo(KDDockWidgets::DockWidget* parent);
protected:
QCheckBox* m_is_floating_checkbox = nullptr;
QLabel* m_label = nullptr;
};
---------------------------MyMainWindow.cpp------------------------
MyMainWindow::MyMainWindow(.. ) {
...
...
connect(newAction, &QAction::triggered, this, [] {
static int count = 0;
count++;
auto w = newMyWidget();
w->setGeometry(100, 100, 400, 400);
auto dock = new KDDockWidgets::DockWidget(QStringLiteral("new dock %1").arg(count));
dock->setWidget(w);
w->connectTo(dock);
dock->resize(600, 600);
dock->show();
});
}
KDDockWidgets::DockWidgetBase *MyMainWindow::newDockWidget()
{
....
....
myWidget->connectTo(dock);
count++;
return dock;
}

To simplify, i have added a checkbox which will be checked if the window is floating. But in the below gif, you can see that checkbox remains checked when dock widget is docked to another floating widget.

FloatingSignalBug

We do not see this issue when widgets are tabbed.
FloatingSignalBug2

If you need more information, please feel free to write back.

Kind Regards
Nandish

@iamsergio iamsergio self-assigned this Sep 25, 2020
@iamsergio iamsergio added the bug Something isn't working label Sep 25, 2020
@nandishnan4
Copy link
Author

Hallo Sergio,

unfortunately the fix does not seem to work. Please have a look at the below gif,
FloatingSignalBug3

The focus problem appears to be solved, last dropped widget has the focus, but the floating signal is not sent the dockwidget which accepts another dock widget. If dock widget A is docked to dock widget B, B does not receive a signal that it is not floating any more, only A receives such a signal and floating status is changed.

Could you please have a look at this issue again.

Kind Regards
Nandish

@iamsergio iamsergio reopened this Sep 29, 2020
@iamsergio
Copy link
Contributor

I reproduced it, fixed it and wrote a test for it, so should be fixed, but you'll maybe right, I'll have another look at it

iamsergio added a commit that referenced this issue Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants