-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [core] add header to dock Widget
support expand/fold operation
- Loading branch information
Showing
11 changed files
with
216 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include "dockheader.h" | ||
|
||
#include <DStyle> | ||
|
||
#include <QHBoxLayout> | ||
#include <QDebug> | ||
|
||
DWIDGET_USE_NAMESPACE | ||
|
||
class DockHeaderPrivate{ | ||
friend class DockHeader; | ||
|
||
QHBoxLayout *mainLayout { nullptr }; | ||
}; | ||
|
||
DockHeader::DockHeader(QWidget *parent) | ||
: DWidget(parent), d(new DockHeaderPrivate) | ||
{ | ||
setAutoFillBackground(true); | ||
setBackgroundRole(DPalette::Base); | ||
|
||
d->mainLayout = new QHBoxLayout(this); | ||
d->mainLayout->setContentsMargins(0, 0, 0, 0); | ||
d->mainLayout->setAlignment(Qt::AlignRight); | ||
} | ||
|
||
DockHeader::~DockHeader() | ||
{ | ||
if (d) | ||
delete d; | ||
} | ||
|
||
void DockHeader::addToolButton(DToolButton *btn) | ||
{ | ||
btn->setFixedSize(20, 20); | ||
d->mainLayout->insertWidget(0, btn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef DOCKHEADER_H | ||
#define DOCKHEADER_H | ||
|
||
#include <DWidget> | ||
#include <DToolButton> | ||
|
||
class DockHeaderPrivate; | ||
class DockHeader : public DTK_WIDGET_NAMESPACE::DWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DockHeader(QWidget *parent = nullptr); | ||
~DockHeader(); | ||
|
||
void addToolButton(DTK_WIDGET_NAMESPACE::DToolButton *btn); | ||
|
||
private: | ||
DockHeaderPrivate *d; | ||
}; | ||
|
||
#endif // DOCKHEADER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.