File indexing completed on 2024-04-28 15:32:14

0001 /*
0002     SPDX-FileCopyrightText: 1997 Michael Roth <mroth@wirlweb.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "kseparator.h"
0008 
0009 class KSeparatorPrivate
0010 {
0011 };
0012 
0013 KSeparator::KSeparator(QWidget *parent, Qt::WindowFlags f)
0014     : QFrame(parent, f)
0015 {
0016     setLineWidth(1);
0017     setMidLineWidth(0);
0018     setOrientation(Qt::Horizontal);
0019 }
0020 
0021 KSeparator::KSeparator(Qt::Orientation orientation, QWidget *parent, Qt::WindowFlags f)
0022     : QFrame(parent, f)
0023 {
0024     setLineWidth(1);
0025     setMidLineWidth(0);
0026     setOrientation(orientation);
0027 }
0028 
0029 KSeparator::~KSeparator() = default;
0030 
0031 void KSeparator::setOrientation(Qt::Orientation orientation)
0032 {
0033     if (orientation == Qt::Vertical) {
0034         setFrameShape(QFrame::VLine);
0035         setFrameShadow(QFrame::Sunken);
0036         setMinimumSize(2, 0);
0037     } else {
0038         setFrameShape(QFrame::HLine);
0039         setFrameShadow(QFrame::Sunken);
0040         setMinimumSize(0, 2);
0041     }
0042     updateGeometry();
0043 }
0044 
0045 Qt::Orientation KSeparator::orientation() const
0046 {
0047     return ((frameStyle() & VLine) == VLine) ? Qt::Vertical : Qt::Horizontal;
0048 }
0049 
0050 #include "moc_kseparator.cpp"