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 | setFrameShadow(QFrame::Sunken); |
36 | setMinimumSize(minw: 2, minh: 0); |
37 | } else { |
38 | setFrameShape(QFrame::HLine); |
39 | setFrameShadow(QFrame::Sunken); |
40 | setMinimumSize(minw: 0, minh: 2); |
41 | } |
42 | updateGeometry(); |
43 | } |
44 | |
45 | Qt::Orientation KSeparator::orientation() const |
46 | { |
47 | return ((frameStyle() & VLine) == VLine) ? Qt::Vertical : Qt::Horizontal; |
48 | } |
49 | |
50 | #include "moc_kseparator.cpp" |
51 | |