Add a property disableDecoration to BufferViewConfig
[quassel.git] / src / qtui / verticaldock.cpp
index 28ebe68..f8090db 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "verticaldock.h"
 
+#include <QLayout>
 #include <QPainter>
 
 #include <QDebug>
@@ -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();
+}