X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fverticaldock.cpp;h=9ad37e4fd52f68ac5c084d9bbf96e606cf43cc78;hp=4ac07fe46b364358970ab281d54403436d0afa7d;hb=694f9bfbf7f1af19108461c7e00d133e55082bce;hpb=25eb89768427a8c62f0ea776d05407db3aec2f97 diff --git a/src/qtui/verticaldock.cpp b/src/qtui/verticaldock.cpp index 4ac07fe4..9ad37e4f 100644 --- a/src/qtui/verticaldock.cpp +++ b/src/qtui/verticaldock.cpp @@ -20,77 +20,89 @@ #include "verticaldock.h" +#include +#include #include #include 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, 15); + +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, 5); - QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 5); - 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(); + 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(); }