File indexing completed on 2024-05-12 05:46:49
0001 /* 0002 * Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU Library General Public License as published by 0006 * the Free Software Foundation; either version 2 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this program; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0017 * 0018 */ 0019 0020 #include "kseparator.h" 0021 0022 KSeparator::KSeparator(QWidget *parent, Qt::WindowFlags f) : QFrame(parent, f) 0023 { 0024 setLineWidth(1); 0025 setMidLineWidth(0); 0026 setOrientation(Qt::Horizontal); 0027 } 0028 0029 KSeparator::KSeparator(Qt::Orientation orientation, QWidget *parent, Qt::WindowFlags f) 0030 : QFrame(parent, f) 0031 { 0032 setLineWidth(1); 0033 setMidLineWidth(0); 0034 setOrientation(orientation); 0035 } 0036 0037 void KSeparator::setOrientation(Qt::Orientation orientation) 0038 { 0039 if (orientation == Qt::Vertical) { 0040 setFrameShape(QFrame::VLine); 0041 setFrameShadow(QFrame::Sunken); 0042 setMinimumSize(2, 0); 0043 } else { 0044 setFrameShape(QFrame::HLine); 0045 setFrameShadow(QFrame::Sunken); 0046 setMinimumSize(0, 2); 0047 } 0048 updateGeometry(); 0049 } 0050 0051 Qt::Orientation KSeparator::orientation() const 0052 { 0053 return ((frameStyle() & VLine) == VLine) ? Qt::Vertical : Qt::Horizontal; 0054 } 0055