Merge branch '1.6'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: KDDockWidgets
|
||||
Upstream-Contact: <info@kdab.com>
|
||||
Upstream-Contact: <info@kdab.com>
|
||||
Source: https://www.github.com/KDAB/KDDockWidgets
|
||||
|
||||
#misc source code
|
||||
@@ -16,7 +16,6 @@ License: GPL-2.0-only OR GPL-3.0-only
|
||||
#misc config files
|
||||
Files: .pre-commit-config.yaml .codespellrc .krazy .cmake-format .clang-format .clazy .gitignore .mdlrc .mdlrc.rb .pep8 .pylintrc appveyor.yml code.dev-*.code-workspace docs/api/Doxyfile.cmake distro/*
|
||||
Copyright: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
License: GPL-2.0-only OR GPL-3.0-only
|
||||
License: BSD-3-Clause
|
||||
|
||||
#artwork
|
||||
|
||||
@@ -876,7 +876,8 @@ FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
*.dox \
|
||||
*.md \
|
||||
*.gif
|
||||
*.gif \
|
||||
*.png
|
||||
|
||||
# The RECURSIVE tag can be used to specify whether or not subdirectories should
|
||||
# be searched for input files as well.
|
||||
|
||||
@@ -68,6 +68,11 @@ void SideBar::onButtonClicked(DockWidgetBase *dw)
|
||||
toggleOverlay(dw);
|
||||
}
|
||||
|
||||
QVector<DockWidgetBase *> SideBar::dockWidgets() const
|
||||
{
|
||||
return m_dockWidgets;
|
||||
}
|
||||
|
||||
void SideBar::onDockWidgetDestroyed(QObject *dw)
|
||||
{
|
||||
removeDockWidget(static_cast<DockWidgetBase *>(dw));
|
||||
|
||||
@@ -66,6 +66,8 @@ protected:
|
||||
|
||||
void onButtonClicked(DockWidgetBase *dw);
|
||||
|
||||
QVector<DockWidgetBase *> dockWidgets() const;
|
||||
|
||||
private:
|
||||
void onDockWidgetDestroyed(QObject *dw);
|
||||
void updateSize();
|
||||
|
||||
@@ -32,6 +32,7 @@ TitleBar::TitleBar(Frame *parent)
|
||||
, Draggable(this)
|
||||
, m_frame(parent)
|
||||
, m_floatingWindow(nullptr)
|
||||
, m_genericWidget(nullptr)
|
||||
, m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
|
||||
{
|
||||
connect(m_frame, &Frame::numDockWidgetsChanged, this, &TitleBar::updateCloseButton);
|
||||
@@ -49,6 +50,7 @@ TitleBar::TitleBar(FloatingWindow *parent)
|
||||
, Draggable(this)
|
||||
, m_frame(nullptr)
|
||||
, m_floatingWindow(parent)
|
||||
, m_genericWidget(nullptr)
|
||||
, m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
|
||||
{
|
||||
connect(m_floatingWindow, &FloatingWindow::numFramesChanged, this, &TitleBar::updateButtons);
|
||||
@@ -57,6 +59,17 @@ TitleBar::TitleBar(FloatingWindow *parent)
|
||||
init();
|
||||
}
|
||||
|
||||
TitleBar::TitleBar(QWidget *parent)
|
||||
: QWidgetAdapter(parent)
|
||||
, Draggable(this, /*enabled=*/false) // We don't allow dragging generic windows at this time
|
||||
, m_frame(nullptr)
|
||||
, m_floatingWindow(nullptr)
|
||||
, m_genericWidget(parent)
|
||||
, m_supportsAutoHide(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void TitleBar::init()
|
||||
{
|
||||
setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
|
||||
@@ -91,7 +104,7 @@ bool TitleBar::onDoubleClicked()
|
||||
|
||||
MainWindowBase *TitleBar::mainWindow() const
|
||||
{
|
||||
if (m_floatingWindow)
|
||||
if (m_floatingWindow || m_genericWidget)
|
||||
return nullptr;
|
||||
|
||||
if (m_frame)
|
||||
@@ -212,6 +225,9 @@ void TitleBar::setIcon(const QIcon &icon)
|
||||
|
||||
std::unique_ptr<WindowBeingDragged> TitleBar::makeWindow()
|
||||
{
|
||||
if (m_genericWidget)
|
||||
return {}; // not applicable
|
||||
|
||||
if (!isVisible() && window()->isVisible() && !(Config::self().flags() & Config::Flag_ShowButtonsOnTabBarIfTitleBarHidden)) {
|
||||
|
||||
// When using Flag_ShowButtonsOnTabBarIfTitleBarHidden we forward the call from the tab bar's
|
||||
@@ -262,6 +278,9 @@ DockWidgetBase *TitleBar::singleDockWidget() const
|
||||
|
||||
bool TitleBar::supportsFloatingButton() const
|
||||
{
|
||||
if (m_genericWidget)
|
||||
return {}; // not applicable
|
||||
|
||||
if (Config::self().flags() & Config::Flag_TitleBarHasMaximizeButton) {
|
||||
// Apps having a maximize/restore button traditionally don't have a floating one,
|
||||
// QDockWidget style only has floating and no maximize/restore.
|
||||
@@ -318,6 +337,8 @@ bool TitleBar::isFocused() const
|
||||
return m_frame->isFocused();
|
||||
else if (m_floatingWindow)
|
||||
return m_floatingWindow->isActiveWindow();
|
||||
else if (m_genericWidget)
|
||||
return m_genericWidget->isActiveWindow();
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -362,6 +383,9 @@ void TitleBar::onCloseClicked()
|
||||
} else {
|
||||
m_floatingWindow->close();
|
||||
}
|
||||
} else if (m_genericWidget) {
|
||||
if (auto window = m_genericWidget->window())
|
||||
window->close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,6 +397,9 @@ bool TitleBar::isFloating() const
|
||||
if (m_frame)
|
||||
return m_frame->isFloating();
|
||||
|
||||
if (m_genericWidget)
|
||||
return false; // Not applicable
|
||||
|
||||
qWarning() << "TitleBar::isFloating: shouldn't happen";
|
||||
return false;
|
||||
}
|
||||
@@ -390,6 +417,9 @@ DockWidgetBase::List TitleBar::dockWidgets() const
|
||||
if (m_frame)
|
||||
return m_frame->dockWidgets();
|
||||
|
||||
if (m_genericWidget)
|
||||
return {}; // Not applicable
|
||||
|
||||
qWarning() << "TitleBar::dockWidget: shouldn't happen";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ public:
|
||||
|
||||
explicit TitleBar(Frame *parent);
|
||||
explicit TitleBar(FloatingWindow *parent);
|
||||
|
||||
/// Allows TitleBar to be used in a non-dockwidget application, for example on a frameless QMessageBox on EGLFS
|
||||
/// Just so we can reuse the existing styling
|
||||
explicit TitleBar(QWidget *parent);
|
||||
|
||||
~TitleBar() override;
|
||||
|
||||
void setTitle(const QString &title);
|
||||
@@ -173,6 +178,7 @@ private:
|
||||
void updateFloatButton();
|
||||
void updateCloseButton();
|
||||
void setCloseButtonEnabled(bool);
|
||||
void setCloseButtonVisible(bool);
|
||||
void setFloatButtonVisible(bool);
|
||||
void setFloatButtonToolTip(const QString &);
|
||||
|
||||
@@ -184,6 +190,7 @@ private:
|
||||
|
||||
Frame *const m_frame;
|
||||
FloatingWindow *const m_floatingWindow;
|
||||
QWidget *const m_genericWidget;
|
||||
const bool m_supportsAutoHide;
|
||||
bool m_closeButtonEnabled = true;
|
||||
bool m_floatButtonVisible = true;
|
||||
|
||||
@@ -29,7 +29,7 @@ class DockWidget;
|
||||
class Frame;
|
||||
class SideBarWidget;
|
||||
|
||||
class SideBarButton : public QToolButton
|
||||
class DOCKS_EXPORT SideBarButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -106,6 +106,14 @@ TitleBarWidget::TitleBarWidget(FloatingWindow *parent)
|
||||
init();
|
||||
}
|
||||
|
||||
TitleBarWidget::TitleBarWidget(QWidget *parent)
|
||||
: TitleBar(parent)
|
||||
, m_layout(new QHBoxLayout(this))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
void TitleBarWidget::init()
|
||||
{
|
||||
qCDebug(creation) << "TitleBarWidget" << this;
|
||||
|
||||
@@ -38,6 +38,7 @@ class DOCKS_EXPORT TitleBarWidget : public TitleBar
|
||||
public:
|
||||
explicit TitleBarWidget(Frame *parent);
|
||||
explicit TitleBarWidget(FloatingWindow *parent);
|
||||
explicit TitleBarWidget(QWidget *parent);
|
||||
~TitleBarWidget() override;
|
||||
|
||||
///@brief getter for the close button
|
||||
|
||||
Reference in New Issue
Block a user