/***************************************************************************
- * Copyright (C) 2005/06 by the Quassel Project *
+ * Copyright (C) 2005-2016 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "verticaldock.h"
+#include <qdrawutil.h>
#include <QLayout>
#include <QPainter>
#include <QDebug>
VerticalDockTitle::VerticalDockTitle(QDockWidget *parent)
- : QWidget(parent)
+ : QWidget(parent)
{
}
-QSize VerticalDockTitle::sizeHint() const {
- return QSize(10, 15);
+
+QSize VerticalDockTitle::sizeHint() const
+{
+ return QSize(8, 15);
}
-QSize VerticalDockTitle::minimumSizeHint() const {
- return QSize(10, 10);
+
+QSize VerticalDockTitle::minimumSizeHint() const
+{
+ 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, 2);
- QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 2);
- qDrawShadeLine(&painter, topLeft, bottomRight, palette());
+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, 2);
+ QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 2);
+ qDrawShadeLine(&painter, topLeft, bottomRight, palette());
+ }
}
- }
}
+
// ==============================
// Vertical Dock
// ==============================
VerticalDock::VerticalDock(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(title, parent, flags)
+ : QDockWidget(title, parent, flags)
{
- setDefaultTitleWidget();
+ setDefaultTitleWidget();
}
+
VerticalDock::VerticalDock(QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(parent, flags)
+ : QDockWidget(parent, flags)
{
- setDefaultTitleWidget();
- setContentsMargins(0, 0, 0, 0);
+ setDefaultTitleWidget();
+ setContentsMargins(0, 0, 0, 0);
}
-void VerticalDock::setDefaultTitleWidget() {
- QWidget *oldDockTitle = titleBarWidget();
- QWidget *newDockTitle = new VerticalDockTitle(this);
- setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
- setFeatures(features() | QDockWidget::DockWidgetVerticalTitleBar);
- setTitleBarWidget(newDockTitle);
-
- if(oldDockTitle)
- oldDockTitle->deleteLater();
+void VerticalDock::setDefaultTitleWidget()
+{
+ QWidget *oldDockTitle = titleBarWidget();
+ QWidget *newDockTitle = new VerticalDockTitle(this);
+
+ setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
+ setFeatures(features() | QDockWidget::DockWidgetVerticalTitleBar);
+ setTitleBarWidget(newDockTitle);
+
+ 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();
+
+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();
}