Add DockWidget::Option_NonDockable
A dock widget with this option will always be floating and not be able to dock into anything. Other widgets can't dock into it either.
This commit is contained in:
@@ -150,6 +150,12 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, AddingOption addi
|
||||
return;
|
||||
}
|
||||
|
||||
if ((other->options() & DockWidgetBase::Option_NotDockable) ||
|
||||
(options() & DockWidgetBase::Option_NotDockable)) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to dock non-dockable widget" << other;
|
||||
return;
|
||||
}
|
||||
|
||||
Frame *frame = this->frame();
|
||||
|
||||
if (frame) {
|
||||
@@ -184,6 +190,12 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other, Loca
|
||||
return;
|
||||
}
|
||||
|
||||
if ((other->options() & DockWidgetBase::Option_NotDockable) ||
|
||||
(options() & DockWidgetBase::Option_NotDockable)) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to dock non-dockable widget" << other;
|
||||
return;
|
||||
}
|
||||
|
||||
if (isWindow())
|
||||
morphIntoFloatingWindow();
|
||||
|
||||
@@ -283,6 +295,11 @@ DockWidgetBase::Options DockWidgetBase::options() const
|
||||
|
||||
void DockWidgetBase::setOptions(Options options)
|
||||
{
|
||||
if ((d->options & Option_NotDockable) != (options & Option_NotDockable)) {
|
||||
qWarning() << Q_FUNC_INFO << "Option_NotDockable not allowed to change. Pass via ctor only.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (options != d->options) {
|
||||
d->options = options;
|
||||
Q_EMIT optionsChanged(options);
|
||||
|
||||
Reference in New Issue
Block a user