67 lines
1.5 KiB
C++
67 lines
1.5 KiB
C++
|
#include "DockWidget.h"
|
||
|
|
||
|
#include <QAbstractButton>
|
||
|
#include <QStyleOptionDockWidget>
|
||
|
#include <QHBoxLayout>
|
||
|
#include <QPaintEvent>
|
||
|
#include <QPainter>
|
||
|
#include <QPainterPath>
|
||
|
#include <QMouseEvent>
|
||
|
#include <QApplication>
|
||
|
|
||
|
|
||
|
DockWidgetTitleBar::DockWidgetTitleBar(QWidget* parent)
|
||
|
: QWidget(parent) {
|
||
|
}
|
||
|
|
||
|
DockWidgetTitleBar::~DockWidgetTitleBar() {
|
||
|
|
||
|
}
|
||
|
|
||
|
QSize DockWidgetTitleBar::minimumSizeHint() const {
|
||
|
QDockWidget* dw = qobject_cast<QDockWidget*>(parentWidget());
|
||
|
Q_ASSERT(dw);
|
||
|
QSize result(0, 90);
|
||
|
if (dw->features() & QDockWidget::DockWidgetVerticalTitleBar)
|
||
|
result.transpose();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
|
||
|
DockWidget::DockWidget(const QString& title, QWidget* parent)
|
||
|
: QDockWidget(title, parent) {
|
||
|
setFeatures(DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable);
|
||
|
}
|
||
|
|
||
|
DockWidget::DockWidget(QWidget* parent)
|
||
|
: QDockWidget(parent) {
|
||
|
setFeatures(DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable);
|
||
|
}
|
||
|
|
||
|
|
||
|
DockWidget::~DockWidget() {
|
||
|
}
|
||
|
|
||
|
void DockWidget::setWindowTitle(const QString& text) {
|
||
|
QDockWidget::setWindowTitle(text);
|
||
|
if (nullptr != titleBar_) {
|
||
|
titleBar_->SetTitle(text);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void DockWidget::SetDockWidgetTitleBar(DockWidgetTitleBar* titleBar) {
|
||
|
titleBar_ = titleBar;
|
||
|
QDockWidget::setTitleBarWidget(titleBar_);
|
||
|
}
|
||
|
|
||
|
void DockWidget::showEvent(QShowEvent* e) {
|
||
|
QDockWidget::showEvent(e);
|
||
|
}
|
||
|
|
||
|
void DockWidget::resizeEvent(QResizeEvent* e) {
|
||
|
QDockWidget::resizeEvent(e);
|
||
|
QStyleOptionDockWidget opt;
|
||
|
initStyleOption(&opt);
|
||
|
}
|
||
|
|