Plasma
Go to the documentation of this file.
26 #include <kmimetype.h>
28 #include "private/themedwidgetinterface_p.h"
35 class CheckBoxPrivate :
public ThemedWidgetInterface<CheckBox>
38 CheckBoxPrivate(CheckBox *c)
39 : ThemedWidgetInterface<CheckBox>(c),
51 if (imagePath.isEmpty()) {
57 KMimeType::Ptr mime = KMimeType::findByPath(absImagePath);
58 QPixmap pm(q->size().toSize());
60 if (mime->is(
"image/svg+xml") || mime->is(
"image/svg+xml-compressed")) {
61 if (!svg || svg->imagePath() != imagePath) {
64 svg->setImagePath(imagePath);
65 QObject::connect(svg, SIGNAL(repaintNeeded()), q, SLOT(setPixmap()));
69 svg->paint(&p, pm.rect());
73 pm = QPixmap(absImagePath);
76 static_cast<QCheckBox*
>(q->widget())->setIcon(QIcon(pm));
86 d(new CheckBoxPrivate(this))
88 QCheckBox *native =
new QCheckBox;
89 connect(native, SIGNAL(
toggled(
bool)),
this, SIGNAL(
toggled(
bool)));
91 native->setWindowIcon(QIcon());
92 native->setAttribute(Qt::WA_NoSystemBackground);
109 return static_cast<QCheckBox*
>(widget())->
text();
114 if (d->imagePath == path) {
122 bool absolutePath = !path.isEmpty() &&
124 !QDir::isRelativePath(path)
126 (path[0] ==
'/' || path.startsWith(QLatin1String(
":/")))
131 d->absImagePath = path;
147 widget()->setStyleSheet(stylesheet);
152 return widget()->styleSheet();
157 return static_cast<QCheckBox*
>(widget());
163 QGraphicsProxyWidget::resizeEvent(event);
173 return static_cast<QCheckBox*
>(widget())->
isChecked();
178 d->changeEvent(event);
179 QGraphicsProxyWidget::changeEvent(event);
184 #include <checkbox.moc>
void setText(const QString &text)
Sets the display text for this CheckBox.
Namespace for everything in libplasma.
void resizeEvent(QGraphicsSceneResizeEvent *event)
void changeEvent(QEvent *event)
CheckBox(QGraphicsWidget *parent=0)
static Theme * defaultTheme()
Singleton pattern accessor.
void setImage(const QString &path)
Sets the path to an image to display.
Q_INVOKABLE QString imagePath(const QString &name) const
Retrieve the path for an SVG image in the current theme.
void setChecked(bool checked)
Sets the checked state.
void setStyleSheet(const QString &stylesheet)
Sets the stylesheet used to control the visual display of this CheckBox.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by
doxygen 1.8.20 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.