• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
thumbnaileditor.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  thumbnaileditor.cpp - description
3  -------------------
4  begin : Thu Mar 2 2005
5  copyright : (C) 2005 by Jason Harris
6  email : kstars@30doradus.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "thumbnaileditor.h"
19 #include "ui_thumbnaileditor.h"
20 #include "thumbnailpicker.h"
21 
22 #include <QPixmap>
23 #include <QMouseEvent>
24 #include <QLabel>
25 #include <QHBoxLayout>
26 #include <QPaintEvent>
27 
28 #include <klocale.h>
29 #include <kdebug.h>
30 #include <kpushbutton.h>
31 
32 
33 ThumbnailEditorUI::ThumbnailEditorUI( QWidget *parent ) : QFrame( parent ) {
34  setupUi( this );
35 }
36 
37 ThumbnailEditor::ThumbnailEditor( ThumbnailPicker *_tp, double _w, double _h )
38  : KDialog( _tp ), tp( _tp )
39 {
40  ui = new ThumbnailEditorUI( this );
41  w = _w;
42  h = _h;
43  ui->MessageLabel->setText( i18n( "Crop region will be scaled to [ %1 * %2 ]", w, h) );
44  setMainWidget( ui );
45  setCaption( i18n( "Edit Thumbnail Image" ) );
46  setButtons( KDialog::Ok|KDialog::Cancel );
47 
48  ui->ImageCanvas->setCropRect( tp->imageRect()->x(), tp->imageRect()->y(),
49  tp->imageRect()->width(), tp->imageRect()->height() );
50  ui->ImageCanvas->setImage( tp->currentListImage() );
51 
52  //DEBUG
53  kDebug() << tp->currentListImage()->size();
54 
55  connect( ui->ImageCanvas, SIGNAL(cropRegionModified()), SLOT( slotUpdateCropLabel() ) );
56  slotUpdateCropLabel();
57 
58  update();
59 }
60 
61 ThumbnailEditor::~ThumbnailEditor()
62 {}
63 
64 QPixmap ThumbnailEditor::thumbnail() {
65  QImage im = ui->ImageCanvas->croppedImage().toImage();
66  im = im.scaled( w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
67  return QPixmap::fromImage( im );
68 }
69 
70 void ThumbnailEditor::slotUpdateCropLabel() {
71  QRect *r = ui->ImageCanvas->cropRect();
72  ui->CropLabel->setText( i18n( "Crop region: [%1,%2 %3x%4]" ,
73  r->left(), r->top(), r->width(), r->height() ) );
74 }
75 
76 #include "thumbnaileditor.moc"
ThumbnailEditor::thumbnail
QPixmap thumbnail()
Definition: thumbnaileditor.cpp:64
ThumbnailEditorUI::ThumbnailEditorUI
ThumbnailEditorUI(QWidget *parent)
Definition: thumbnaileditor.cpp:33
QWidget
KDialog
ThumbnailEditorUI
Definition: thumbnaileditor.h:30
ThumbnailEditor::~ThumbnailEditor
~ThumbnailEditor()
Definition: thumbnaileditor.cpp:61
thumbnaileditor.h
ThumbnailEditor::ThumbnailEditor
ThumbnailEditor(ThumbnailPicker *_tp, double _w, double _h)
Definition: thumbnaileditor.cpp:37
thumbnailpicker.h
QFrame
ThumbnailPicker::imageRect
QRect * imageRect() const
Definition: thumbnailpicker.h:53
ThumbnailPicker::currentListImage
QPixmap * currentListImage()
Definition: thumbnailpicker.h:51
ThumbnailPicker
Dialog for modifying an object's thumbnail image.
Definition: thumbnailpicker.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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