| 1 | /* |
| 2 | SPDX-FileCopyrightText: 1997 Michael Roth <mroth@wirlweb.de> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #include "kseparator.h" |
| 8 | |
| 9 | class KSeparatorPrivate |
| 10 | { |
| 11 | }; |
| 12 | |
| 13 | KSeparator::KSeparator(QWidget *parent, Qt::WindowFlags f) |
| 14 | : QFrame(parent, f) |
| 15 | { |
| 16 | setLineWidth(1); |
| 17 | setMidLineWidth(0); |
| 18 | setOrientation(Qt::Horizontal); |
| 19 | } |
| 20 | |
| 21 | KSeparator::KSeparator(Qt::Orientation orientation, QWidget *parent, Qt::WindowFlags f) |
| 22 | : QFrame(parent, f) |
| 23 | { |
| 24 | setLineWidth(1); |
| 25 | setMidLineWidth(0); |
| 26 | setOrientation(orientation); |
| 27 | } |
| 28 | |
| 29 | KSeparator::~KSeparator() = default; |
| 30 | |
| 31 | void KSeparator::setOrientation(Qt::Orientation orientation) |
| 32 | { |
| 33 | if (orientation == Qt::Vertical) { |
| 34 | setFrameShape(QFrame::VLine); |
| 35 | setFixedWidth(1); |
| 36 | } else { |
| 37 | setFrameShape(QFrame::HLine); |
| 38 | setFixedHeight(1); |
| 39 | } |
| 40 | updateGeometry(); |
| 41 | } |
| 42 | |
| 43 | Qt::Orientation KSeparator::orientation() const |
| 44 | { |
| 45 | return ((frameStyle() & VLine) == VLine) ? Qt::Vertical : Qt::Horizontal; |
| 46 | } |
| 47 | |
| 48 | #include "moc_kseparator.cpp" |
| 49 | |