KDEUI
kseparator.cpp
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 */ 00019 00020 #include "kseparator.h" 00021 #include <QStyle> 00022 #include <QStyleOption> 00023 #include <QPainter> 00024 00025 KSeparator::KSeparator(QWidget* parent, Qt::WFlags f) : QFrame(parent, f) 00026 { 00027 setLineWidth(1); 00028 setMidLineWidth(0); 00029 setOrientation( Qt::Horizontal ); 00030 } 00031 00032 00033 KSeparator::KSeparator(Qt::Orientation orientation, QWidget* parent, Qt::WFlags f) 00034 : QFrame(parent, f) 00035 { 00036 setLineWidth(1); 00037 setMidLineWidth(0); 00038 setOrientation( orientation ); 00039 } 00040 00041 00042 void KSeparator::setOrientation(Qt::Orientation orientation) 00043 { 00044 if (orientation == Qt::Vertical) { 00045 setFrameShape ( QFrame::VLine ); 00046 setFrameShadow( QFrame::Sunken ); 00047 setMinimumSize(2, 0); 00048 } 00049 else { 00050 setFrameShape ( QFrame::HLine ); 00051 setFrameShadow( QFrame::Sunken ); 00052 setMinimumSize(0, 2); 00053 } 00054 updateGeometry(); 00055 } 00056 00057 Qt::Orientation KSeparator::orientation() const 00058 { 00059 return ((frameStyle() & VLine) == VLine) ? Qt::Vertical : Qt::Horizontal; 00060 } 00061 00062 #include "kseparator.moc"
KDE 4.6 API Reference