#include "verticaldock.h"
+#include <QLayout>
#include <QPainter>
#include <QDebug>
{
}
-VerticalDockTitle::~VerticalDockTitle() {
-}
-
QSize VerticalDockTitle::sizeHint() const {
- return QSize(10, 15);
+ return QSize(8, 15);
}
QSize VerticalDockTitle::minimumSizeHint() const {
- return QSize(10, 15);
+ return QSize(8, 10);
}
void VerticalDockTitle::paintEvent(QPaintEvent *event) {
Q_UNUSED(event);
-
+
QPainter painter(this);
if(rect().isValid() && rect().height() > minimumSizeHint().height()) {
for(int i = 0; i < 2; i++) {
- QPoint topLeft = rect().topLeft() + QPoint(3 + i*2, 5);
- QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 5);
+ QPoint topLeft = rect().topLeft() + QPoint(3 + i*2, 2);
+ QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 2);
qDrawShadeLine(&painter, topLeft, bottomRight, palette());
}
}
-
}
-
// ==============================
// Vertical Dock
// ==============================
: QDockWidget(parent, flags)
{
setDefaultTitleWidget();
-}
-
-VerticalDock::~VerticalDock() {
+ setContentsMargins(0, 0, 0, 0);
}
void VerticalDock::setDefaultTitleWidget() {
if(oldDockTitle)
oldDockTitle->deleteLater();
}
+
+void VerticalDock::showTitle(bool show) {
+ QWidget *oldDockTitle = titleBarWidget();
+ QWidget *newDockTitle = 0;
+
+ if(show)
+ newDockTitle = new VerticalDockTitle(this);
+ else
+ newDockTitle = new EmptyDockTitle(this);
+
+ setTitleBarWidget(newDockTitle);
+ if(oldDockTitle)
+ oldDockTitle->deleteLater();
+}