• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

PlasmaComponents

  • sources
  • kde-4.14
  • kde-runtime
  • plasma
  • declarativeimports
  • plasmacomponents
fullscreensheet.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #include "fullscreensheet.h"
21 
22 #include <QApplication>
23 #include <QDesktopWidget>
24 #include <QGraphicsView>
25 
26 #include <KDebug>
27 
28 FullScreenSheet::FullScreenSheet(QDeclarativeItem *parent)
29  : FullScreenWindow(parent)
30 {
31  init("Sheet");
32 
33  view()->setGeometry(QApplication::desktop()->availableGeometry());
34 
35  if (mainItem()) {
36  connect(mainItem(), SIGNAL(titleChanged()),
37  this, SIGNAL(titleChanged()));
38  connect(mainItem(), SIGNAL(acceptButtonChanged()),
39  this, SIGNAL(acceptButtonChanged()));
40  connect(mainItem(), SIGNAL(rejectButtonChanged()),
41  this, SIGNAL(rejectButtonChanged()));
42  connect(mainItem(), SIGNAL(acceptButtonTextChanged()),
43  this, SIGNAL(acceptButtonTextChanged()));
44  connect(mainItem(), SIGNAL(rejectButtonTextChanged()),
45  this, SIGNAL(rejectButtonTextChanged()));
46  }
47 }
48 
49 FullScreenSheet::~FullScreenSheet()
50 {
51 }
52 
53 QString FullScreenSheet::title() const
54 {
55  if (mainItem()) {
56  return mainItem()->property("title").toString();
57  } else {
58  return 0;
59  }
60 }
61 
62 void FullScreenSheet::setTitle(const QString &text)
63 {
64  if (mainItem()) {
65  mainItem()->setProperty("title", QVariant::fromValue(text));
66  }
67 }
68 
69 QDeclarativeItem *FullScreenSheet::acceptButton() const
70 {
71  if (mainItem()) {
72  return mainItem()->property("acceptButton").value<QDeclarativeItem *>();
73  } else {
74  return 0;
75  }
76 }
77 
78 void FullScreenSheet::setAcceptButton(QDeclarativeItem *button)
79 {
80  if (mainItem()) {
81  mainItem()->setProperty("acceptButton", QVariant::fromValue(button));
82  }
83 }
84 
85 QDeclarativeItem *FullScreenSheet::rejectButton() const
86 {
87  if (mainItem()) {
88  return mainItem()->property("rejectButton").value<QDeclarativeItem *>();
89  } else {
90  return 0;
91  }
92 }
93 
94 void FullScreenSheet::setRejectButton(QDeclarativeItem *button)
95 {
96  if (mainItem()) {
97  mainItem()->setProperty("rejectButton", QVariant::fromValue(button));
98  }
99 }
100 
101 QString FullScreenSheet::acceptButtonText() const
102 {
103  if (mainItem()) {
104  return mainItem()->property("acceptButtonText").toString();
105  } else {
106  return 0;
107  }
108 }
109 
110 void FullScreenSheet::setAcceptButtonText(const QString &text)
111 {
112  if (mainItem()) {
113  mainItem()->setProperty("acceptButtonText", QVariant::fromValue(text));
114  }
115 }
116 
117 QString FullScreenSheet::rejectButtonText() const
118 {
119  if (mainItem()) {
120  return mainItem()->property("rejectButtonText").toString();
121  } else {
122  return 0;
123  }
124 }
125 
126 void FullScreenSheet::setRejectButtonText(const QString &text)
127 {
128  if (mainItem()) {
129  mainItem()->setProperty("rejectButtonText", QVariant::fromValue(text));
130  }
131 }
132 
133 void FullScreenSheet::open()
134 {
135  if (mainItem()) {
136  view()->setGeometry(QApplication::desktop()->availableGeometry());
137  QMetaObject::invokeMethod(mainItem(), "open");
138  }
139 }
140 
141 
142 #include "fullscreensheet.moc"
143 
FullScreenSheet::setAcceptButtonText
void setAcceptButtonText(const QString &text)
Definition: fullscreensheet.cpp:110
FullScreenSheet::acceptButtonText
QString acceptButtonText() const
FullScreenSheet::title
QString title() const
FullScreenSheet::setRejectButton
void setRejectButton(QDeclarativeItem *button)
Definition: fullscreensheet.cpp:94
FullScreenSheet::rejectButtonTextChanged
void rejectButtonTextChanged()
fullscreensheet.h
QVariant::value
T value() const
QWidget::setGeometry
void setGeometry(int x, int y, int w, int h)
FullScreenSheet::FullScreenSheet
FullScreenSheet(QDeclarativeItem *parent=0)
Definition: fullscreensheet.cpp:28
QObject::property
QVariant property(const char *name) const
FullScreenSheet::rejectButton
QDeclarativeItem * rejectButton() const
FullScreenSheet::setAcceptButton
void setAcceptButton(QDeclarativeItem *button)
Definition: fullscreensheet.cpp:78
QString
FullScreenWindow::mainItem
QGraphicsObject * mainItem() const
Definition: fullscreenwindow.cpp:166
FullScreenSheet::~FullScreenSheet
~FullScreenSheet()
Definition: fullscreensheet.cpp:49
FullScreenWindow::view
QGraphicsView * view() const
Definition: fullscreenwindow.cpp:295
QVariant::fromValue
QVariant fromValue(const T &value)
QMetaObject::invokeMethod
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
FullScreenSheet::rejectButtonText
QString rejectButtonText() const
FullScreenSheet::setRejectButtonText
void setRejectButtonText(const QString &text)
Definition: fullscreensheet.cpp:126
FullScreenSheet::open
Q_INVOKABLE void open()
Definition: fullscreensheet.cpp:133
FullScreenSheet::titleChanged
void titleChanged()
QApplication::desktop
QDesktopWidget * desktop()
FullScreenWindow::init
void init(const QString &componentName)
Definition: fullscreenwindow.cpp:120
FullScreenSheet::setTitle
void setTitle(const QString &text)
Definition: fullscreensheet.cpp:62
FullScreenSheet::acceptButton
QDeclarativeItem * acceptButton() const
FullScreenSheet::acceptButtonChanged
void acceptButtonChanged()
QObject::setProperty
bool setProperty(const char *name, const QVariant &value)
QDeclarativeItem
FullScreenSheet::acceptButtonTextChanged
void acceptButtonTextChanged()
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QVariant::toString
QString toString() const
FullScreenWindow
Definition: fullscreenwindow.h:38
FullScreenSheet::rejectButtonChanged
void rejectButtonChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

PlasmaComponents

Skip menu "PlasmaComponents"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal