1
/***************************************************************************
2
qgscomposerlabelwidget.cpp
3
--------------------------
5
copyright : (C) 2008 by Marco Hugentobler
6
email : marco dot hugentobler at karto dot baug dot ethz dot ch
7
***************************************************************************/
9
/***************************************************************************
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. *
16
***************************************************************************/
18
#include "qgscomposerlabelwidget.h"
19
#include "qgscomposerlabel.h"
20
#include "qgscomposeritemwidget.h"
21
#include <QColorDialog>
22
#include <QFontDialog>
25
QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QWidget(), mComposerLabel( label )
29
//add widget for general composer item properties
30
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
31
toolBox->addItem( itemPropertiesWidget, tr( "General options" ) );
35
mTextEdit->setText( mComposerLabel->text() );
36
mMarginDoubleSpinBox->setValue( mComposerLabel->margin() );
40
void QgsComposerLabelWidget::on_mTextEdit_textChanged()
44
mComposerLabel->setText( mTextEdit->toPlainText() );
45
mComposerLabel->update();
49
void QgsComposerLabelWidget::on_mFontButton_clicked()
54
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
55
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
56
QFont newFont = QFontDialog::getFont( &ok, mComposerLabel->font(), this, QString(), QFontDialog::DontUseNativeDialog );
58
QFont newFont = QFontDialog::getFont( &ok, mComposerLabel->font(), this );
62
mComposerLabel->setFont( newFont );
63
mComposerLabel->update();
68
void QgsComposerLabelWidget::on_mMarginDoubleSpinBox_valueChanged( double d )
72
mComposerLabel->setMargin( d );
73
mComposerLabel->update();
77
void QgsComposerLabelWidget::on_mFontColorButton_clicked()
79
if ( !mComposerLabel )
83
QColor newColor = QColorDialog::getColor( mComposerLabel->fontColor() );
84
if ( !newColor.isValid() )
88
mComposerLabel->setFontColor( newColor );