[Kde-bindings] KDE/kdebindings/php/phpqt/examples/screenshot
Thomas Moenicke
tm at php-qt.org
Thu Nov 13 23:00:57 UTC 2008
SVN commit 883993 by moenicke:
* made screenshot example working, slots are public for now, needs to be fixed
CCMAIL: kde-bindings at kde.org
M +11 -11 screenshot.php
--- trunk/KDE/kdebindings/php/phpqt/examples/screenshot/screenshot.php #883992:883993
@@ -3,6 +3,7 @@
class Screenshot extends QWidget
{
+ public $signals = array("");
public $slots = array( "newScreenshot()",
"saveScreenshot()",
"shootScreenshot()",
@@ -117,13 +118,13 @@
/**
* @slot
*/
- private function saveScreenshot()
+ public function saveScreenshot()
{
$format = new QString("png");
$initialPath = QDir::currentPath() . tr("/untitled.") . $format;
$fileName = QFileDialog::getSaveFileName($this, tr("Save As"),
- $this->initialPath,
+ $initialPath,
tr("%1 Files (*.%2);;All Files (*)")
->arg($format->toUpper())
->arg($format));
@@ -134,11 +135,11 @@
/**
* @slot
*/
- private function shootScreen()
+ public function shootScreen()
{
if($this->delaySpinBox->value() != 0)
QCoreApplication::instance()->beep();
- $this->originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
+ $this->originalPixmap = QPixmap::grabWindow(QCoreApplication::instance()->desktop()->winId());
$this->updateScreenshotLabel();
$this->newScreenshotButton->setDisabled(false);
@@ -149,7 +150,7 @@
/**
* @slot
*/
- private function updateCheckBox()
+ public function updateCheckBox()
{
if($this->delaySpinBox->value() == 0)
$this->hideThisWindowCheckBox->setDisabled(true);
@@ -165,7 +166,7 @@
$this->delaySpinBox->setSuffix(tr(" s"));
$this->delaySpinBox->setMaximum(60);
- $this->connect($this->delaySpinBox, SIGNAL("valueChanged(int)"), this, SLOT("updateCheckBox()"));
+ $this->connect($this->delaySpinBox, SIGNAL("valueChanged(int)"), $this, SLOT("updateCheckBox()"));
$this->delaySpinBoxLabel = new QLabel(tr("Screenshot Delay:"));
@@ -180,13 +181,13 @@
private function createButtonsLayout()
{
- $this->newScreenshotButton = createButton(tr("New Screenshot"),
+ $this->newScreenshotButton = $this->createButton(tr("New Screenshot"),
$this, SLOT("newScreenshot()"));
- $this->saveScreenshotButton = createButton(tr("Save Screenshot"),
+ $this->saveScreenshotButton = $this->createButton(tr("Save Screenshot"),
$this, SLOT("saveScreenshot()"));
- $this->quitScreenshotButton = createButton(tr("Quit"), $this, SLOT("close()"));
+ $this->quitScreenshotButton = $this->createButton(tr("Quit"), $this, SLOT("close()"));
$this->buttonsLayout = new QHBoxLayout;
$this->buttonsLayout->addStretch();
@@ -207,7 +208,7 @@
private function updateScreenshotLabel()
{
- $this->screenshotLabel->setPixmap($this->originalPixmap.scaled(
+ $this->screenshotLabel->setPixmap($this->originalPixmap->scaled(
$this->screenshotLabel->size(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation));
@@ -215,5 +216,4 @@
}
- #endif
?>
\ No newline at end of file
More information about the Kde-bindings
mailing list