Made font configurable in inplace text annotations

remotes/origin/epub-qtextdoc
Fabio D'Urso 14 years ago
parent 04e008de89
commit 38a5a3f526
  1. 11
      conf/widgetannottools.cpp
  2. 7
      ui/pageviewannotator.cpp

@ -18,6 +18,7 @@
#include <knuminput.h> #include <knuminput.h>
#include <kpushbutton.h> #include <kpushbutton.h>
#include <QtGui/QApplication>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QGroupBox> #include <QtGui/QGroupBox>
@ -351,7 +352,8 @@ QDomDocument EditAnnotToolDialog::toolXml() const
engineElement.setAttribute( "block", "true" ); engineElement.setAttribute( "block", "true" );
annotationElement.setAttribute( "type", "FreeText" ); annotationElement.setAttribute( "type", "FreeText" );
annotationElement.setAttribute( "color", color ); annotationElement.setAttribute( "color", color );
// TODO: Font if ( ta->textFont() != QApplication::font() )
annotationElement.setAttribute( "font", ta->textFont().toString() );
} }
else if ( toolType == "ink" ) else if ( toolType == "ink" )
{ {
@ -590,6 +592,13 @@ void EditAnnotToolDialog::loadTool( const QDomElement &toolElement )
else if ( annotType == "note-inline" ) else if ( annotType == "note-inline" )
{ {
setToolType( "note-inline" ); setToolType( "note-inline" );
Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann );
if ( annotationElement.hasAttribute( "font" ) )
{
QFont f;
f.fromString( annotationElement.attribute( "font" ) );
ta->setTextFont( f );
}
} }
else if ( annotType == "note-linked" ) else if ( annotType == "note-linked" )
{ {

@ -167,6 +167,13 @@ class PickPointEngine : public AnnotatorEngine
ann = ta; ann = ta;
ta->setInplaceText( note ); ta->setInplaceText( note );
ta->setTextType( Okular::TextAnnotation::InPlace ); ta->setTextType( Okular::TextAnnotation::InPlace );
//set font
if ( m_annotElement.hasAttribute( "font" ) )
{
QFont f;
f.fromString( m_annotElement.attribute( "font" ) );
ta->setTextFont( f );
}
//set boundary //set boundary
rect.left = qMin(startpoint.x,point.x); rect.left = qMin(startpoint.x,point.x);
rect.top = qMin(startpoint.y,point.y); rect.top = qMin(startpoint.y,point.y);

Loading…
Cancel
Save