Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[FEATURE]: arrow item for composer. Custom arrow heads from svg files…
… are planned for the near future git-svn-id: http://svn.osgeo.org/qgis/trunk@12248 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
mhugent
committed
Nov 25, 2009
1 parent
9fceb43
commit af96cfd
Showing
12 changed files
with
774 additions
and
6 deletions.
There are no files selected for viewing
BIN
+537 Bytes
images/themes/default/mActionAddArrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/*************************************************************************** | ||
qgscomposerarrowwidget.cpp | ||
-------------------------- | ||
begin : November 2009 | ||
copyright : (C) 2009 by Marco Hugentobler | ||
email : marco@hugis.net | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgscomposerarrowwidget.h" | ||
#include "qgscomposerarrow.h" | ||
#include "qgscomposeritemwidget.h" | ||
#include <QColorDialog> | ||
|
||
QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QWidget( 0 ), mArrow( arrow ) | ||
{ | ||
setupUi( this ); | ||
|
||
//add widget for general composer item properties | ||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, mArrow ); | ||
toolBox->addItem( itemPropertiesWidget, tr( "General options" ) ); | ||
|
||
setGuiElementValues(); | ||
} | ||
|
||
QgsComposerArrowWidget::~QgsComposerArrowWidget() | ||
{ | ||
|
||
} | ||
|
||
void QgsComposerArrowWidget::on_mOutlineWidthSpinBox_valueChanged( double d ) | ||
{ | ||
if ( !mArrow ) | ||
{ | ||
return; | ||
} | ||
|
||
mArrow->setOutlineWidth( d ); | ||
mArrow->update(); | ||
} | ||
|
||
void QgsComposerArrowWidget::on_mArrowHeadWidthSpinBox_valueChanged( double d ) | ||
{ | ||
if ( !mArrow ) | ||
{ | ||
return; | ||
} | ||
|
||
mArrow->setArrowHeadWidth( d ); | ||
mArrow->update(); | ||
} | ||
|
||
void QgsComposerArrowWidget::on_mShowArrowHeadCheckBox_stateChanged( int state ) | ||
{ | ||
if ( !mArrow ) | ||
{ | ||
return; | ||
} | ||
|
||
if ( state == Qt::Checked ) | ||
{ | ||
mArrow->setShowArrowMarker( true ); | ||
} | ||
else | ||
{ | ||
mArrow->setShowArrowMarker( false ); | ||
} | ||
mArrow->update(); | ||
} | ||
|
||
void QgsComposerArrowWidget::on_mArrowColorButton_clicked() | ||
{ | ||
if ( !mArrow ) | ||
{ | ||
return; | ||
} | ||
|
||
QColor newColor = QColorDialog::getColor( mArrow->arrowColor(), 0, tr( "Arrow color" ), QColorDialog::ShowAlphaChannel ); | ||
if ( newColor.isValid() ) | ||
{ | ||
mArrow->setArrowColor( newColor ); | ||
mArrow->update(); | ||
} | ||
} | ||
|
||
void QgsComposerArrowWidget::blockAllSignals( bool block ) | ||
{ | ||
mArrowColorButton->blockSignals( block ); | ||
mShowArrowHeadCheckBox->blockSignals( block ); | ||
mOutlineWidthSpinBox->blockSignals( block ); | ||
mArrowHeadWidthSpinBox->blockSignals( block ); | ||
} | ||
|
||
void QgsComposerArrowWidget::setGuiElementValues() | ||
{ | ||
if ( !mArrow ) | ||
{ | ||
return; | ||
} | ||
|
||
blockAllSignals( true ); | ||
mOutlineWidthSpinBox->setValue( mArrow->outlineWidth() ); | ||
mArrowHeadWidthSpinBox->setValue( mArrow->arrowHeadWidth() ); | ||
if ( mArrow->showArrowMarker() ) | ||
{ | ||
mShowArrowHeadCheckBox->setCheckState( Qt::Checked ); | ||
} | ||
else | ||
{ | ||
mShowArrowHeadCheckBox->setCheckState( Qt::Unchecked ); | ||
} | ||
blockAllSignals( false ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*************************************************************************** | ||
qgscomposerarrowwidget.h | ||
------------------------ | ||
begin : November 2009 | ||
copyright : (C) 2009 by Marco Hugentobler | ||
email : marco@hugis.net | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSCOMPOSERARROWWIDGET_H | ||
#define QGSCOMPOSERARROWWIDGET_H | ||
|
||
#include "ui_qgscomposerarrowwidgetbase.h" | ||
|
||
class QgsComposerArrow; | ||
|
||
class QgsComposerArrowWidget: public QWidget, private Ui::QgsComposerArrowWidgetBase | ||
{ | ||
Q_OBJECT | ||
public: | ||
QgsComposerArrowWidget( QgsComposerArrow* arrow ); | ||
~QgsComposerArrowWidget(); | ||
|
||
private: | ||
QgsComposerArrow* mArrow; | ||
|
||
void blockAllSignals( bool block ); | ||
void setGuiElementValues(); | ||
|
||
private slots: | ||
void on_mOutlineWidthSpinBox_valueChanged( double d ); | ||
void on_mArrowHeadWidthSpinBox_valueChanged( double d ); | ||
void on_mShowArrowHeadCheckBox_stateChanged( int state ); | ||
void on_mArrowColorButton_clicked(); | ||
}; | ||
|
||
#endif // QGSCOMPOSERARROWWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.