X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fverticaldock.cpp;h=f8090db93dd8e63a35d00f5bb58eac9c2684048d;hp=28ebe6820e7731c3c426c6dc578b984b1528b529;hb=b1d9c3ea56467245c910ac1de1252c2a91c234f0;hpb=6ffaa82b95c0be603b9f94688c435bdcf6129230 diff --git a/src/qtui/verticaldock.cpp b/src/qtui/verticaldock.cpp index 28ebe682..f8090db9 100644 --- a/src/qtui/verticaldock.cpp +++ b/src/qtui/verticaldock.cpp @@ -20,6 +20,7 @@ #include "verticaldock.h" +#include #include #include @@ -29,33 +30,28 @@ VerticalDockTitle::VerticalDockTitle(QDockWidget *parent) { } -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 // ============================== @@ -69,9 +65,7 @@ VerticalDock::VerticalDock(QWidget *parent, Qt::WindowFlags flags) : QDockWidget(parent, flags) { setDefaultTitleWidget(); -} - -VerticalDock::~VerticalDock() { + setContentsMargins(0, 0, 0, 0); } void VerticalDock::setDefaultTitleWidget() { @@ -85,3 +79,17 @@ 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(); +}