Plasma
groupbox.cpp
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 Aaron Seigo <aseigo@kde.org> 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 00006 * published by the Free Software Foundation; either version 2, 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 General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "groupbox.h" 00021 00022 #include <QGroupBox> 00023 #include <QIcon> 00024 #include <QPainter> 00025 00026 #include <kmimetype.h> 00027 00028 #include "svg.h" 00029 #include "private/themedwidgetinterface_p.h" 00030 #include "theme.h" 00031 00032 namespace Plasma 00033 { 00034 00035 class GroupBoxPrivate : public ThemedWidgetInterface<GroupBox> 00036 { 00037 public: 00038 GroupBoxPrivate(GroupBox *groupBox) 00039 :ThemedWidgetInterface<GroupBox>(groupBox) 00040 { 00041 } 00042 00043 ~GroupBoxPrivate() 00044 { 00045 } 00046 }; 00047 00048 GroupBox::GroupBox(QGraphicsWidget *parent) 00049 : QGraphicsProxyWidget(parent), 00050 d(new GroupBoxPrivate(this)) 00051 { 00052 QGroupBox *native = new QGroupBox; 00053 setWidget(native); 00054 native->setWindowIcon(QIcon()); 00055 native->setAttribute(Qt::WA_NoSystemBackground); 00056 d->initTheming(); 00057 } 00058 00059 GroupBox::~GroupBox() 00060 { 00061 delete d; 00062 } 00063 00064 void GroupBox::setText(const QString &text) 00065 { 00066 static_cast<QGroupBox*>(widget())->setTitle(text); 00067 } 00068 00069 QString GroupBox::text() const 00070 { 00071 return static_cast<QGroupBox*>(widget())->title(); 00072 } 00073 00074 void GroupBox::setStyleSheet(const QString &stylesheet) 00075 { 00076 widget()->setStyleSheet(stylesheet); 00077 } 00078 00079 QString GroupBox::styleSheet() 00080 { 00081 return widget()->styleSheet(); 00082 } 00083 00084 QGroupBox *GroupBox::nativeWidget() const 00085 { 00086 return static_cast<QGroupBox*>(widget()); 00087 } 00088 00089 void GroupBox::resizeEvent(QGraphicsSceneResizeEvent *event) 00090 { 00091 QGraphicsProxyWidget::resizeEvent(event); 00092 } 00093 00094 void GroupBox::changeEvent(QEvent *event) 00095 { 00096 d->changeEvent(event); 00097 QGraphicsProxyWidget::changeEvent(event); 00098 } 00099 00100 } // namespace Plasma 00101 00102 #include <groupbox.moc> 00103
KDE 4.6 API Reference