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

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • annotate
TextEditor.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Andrew Manson <g.real.ate@gmail.com>
9 // Copyright 2013 Thibaut Gridel <tgridel@free.fr>
10 //
11 
12 #include "TextEditor.h"
13 
14 #include "GeoDataPlacemark.h"
15 #include "MarbleDebug.h"
16 
17 #include <QAction>
18 #include <QApplication>
19 #include <QLineEdit>
20 #include <QToolButton>
21 #include <QTextEdit>
22 #include <QHBoxLayout>
23 
24 
25 namespace Marble
26 {
27 
28 TextEditor::TextEditor( GeoDataPlacemark *placemark ) :
29  QWidget(),
30  m_placemark( placemark )
31 {
32  setCursor( Qt::ArrowCursor );
33 
34  m_buttonLayout = new QHBoxLayout;
35  m_layout = new QVBoxLayout;
36 
37  /*
38  *Note: these widgets do not need to be constructed with a parent
39  *as adding them to a layout automatically sets the parent. If a
40  *parent is already set it will mess up the layouts.
41  */
42  m_description = new QTextEdit;
43  m_description->setText( placemark->description() );
44  m_description->setMinimumHeight( 50 );
45  m_description->setSizePolicy( QSizePolicy::Fixed,
46  QSizePolicy::MinimumExpanding );
47  m_description->viewport()->setSizePolicy( QSizePolicy::Fixed,
48  QSizePolicy::MinimumExpanding );
49  m_description->viewport()->setAutoFillBackground( true );
50  QApplication::setPalette( QPalette() );
51  m_description->setBackgroundRole( QPalette::Window );
52  connect( m_description, SIGNAL(textChanged()),
53  this, SLOT(updateDescription()) );
54 
55  m_name = new QLineEdit;
56  m_name->setText( placemark->name() );
57  connect( m_name, SIGNAL(textChanged(QString)),
58  this, SLOT(updateName()) );
59 
60  // setup the actions and create the buttons
61  m_boldAction = new QAction( this );
62  m_boldAction->setText(tr("Bold"));
63  m_boldButton = new QToolButton;
64  m_boldButton->setDefaultAction( m_boldAction );
65 
66  m_italicAction = new QAction( this );
67  m_italicAction->setText( tr("Italic") );
68  m_italicButton = new QToolButton;
69  m_italicButton->setDefaultAction( m_italicAction );
70 
71  m_underLineAction = new QAction( this );
72  m_underLineAction->setText( tr("Underline") );
73  m_underLineButton = new QToolButton;
74  m_underLineButton->setDefaultAction( m_underLineAction );
75 
76  //add them all to their correct places
77  m_buttonLayout->addWidget( m_boldButton );
78  m_buttonLayout->addWidget( m_italicButton );
79  m_buttonLayout->addWidget( m_underLineButton );
80 
81  m_layout->addWidget( m_name );
82  m_layout->addLayout( m_buttonLayout );
83  m_layout->addWidget( m_description );
84 
85  setLayout( m_layout );
86  setMaximumWidth( 250 );
87  setMinimumHeight( 50 );
88  setSizePolicy( QSizePolicy::Fixed, QSizePolicy::MinimumExpanding );
89 }
90 
91 TextEditor::~TextEditor()
92 {
93 }
94 
95 void TextEditor::updateName()
96 {
97  m_placemark->setName( m_name->text() );
98 }
99 
100 void TextEditor::updateDescription()
101 {
102  m_placemark->setDescription( m_description->toHtml() );
103 }
104 }
105 
106 #include "TextEditor.moc"
Marble::TextEditor::~TextEditor
~TextEditor()
Definition: TextEditor.cpp:91
Marble::GeoDataFeature::setDescription
void setDescription(const QString &value)
Set the description of this feature to value.
Definition: GeoDataFeature.cpp:518
QWidget
Marble::GeoDataFeature::description
QString description() const
Return the text description of the feature.
Definition: GeoDataFeature.cpp:513
MarbleDebug.h
TextEditor.h
Marble::GeoDataFeature::setName
void setName(const QString &value)
Set a new name for this feature.
Definition: GeoDataFeature.cpp:485
Marble::TextEditor::TextEditor
TextEditor(GeoDataPlacemark *placemark)
Definition: TextEditor.cpp:28
GeoDataPlacemark.h
Marble::TextEditor::updateDescription
void updateDescription()
Definition: TextEditor.cpp:100
Marble::GeoDataFeature::name
QString name() const
The name of the feature.
Definition: GeoDataFeature.cpp:480
Marble::TextEditor::updateName
void updateName()
Definition: TextEditor.cpp:95
QLineEdit
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • 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