-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect signal slots for html dialog
- Loading branch information
Showing
10 changed files
with
238 additions
and
9 deletions.
There are no files selected for viewing
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,74 @@ | ||
#include "qgscomposerhtmlwidget.h" | ||
#include "qgscomposerhtml.h" | ||
#include <QFileDialog> | ||
|
||
QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html ): mHtml( html ) | ||
{ | ||
setupUi( this ); | ||
mResizeModeComboBox->addItem( tr( "Use existing frames" ), QgsComposerMultiFrame::UseExistingFrames ); | ||
mResizeModeComboBox->addItem( tr( "Extend to next page" ), QgsComposerMultiFrame::ExtendToNextPage ); | ||
} | ||
|
||
QgsComposerHtmlWidget::QgsComposerHtmlWidget() | ||
{ | ||
} | ||
|
||
QgsComposerHtmlWidget::~QgsComposerHtmlWidget() | ||
{ | ||
} | ||
|
||
void QgsComposerHtmlWidget::blockSignals( bool block ) | ||
{ | ||
mUrlLineEdit->blockSignals( block ); | ||
mFileToolButton->blockSignals( block ); | ||
mResizeModeComboBox->blockSignals( block ); | ||
} | ||
|
||
void QgsComposerHtmlWidget::on_mUrlLineEdit_editingFinished() | ||
{ | ||
if ( mHtml ) | ||
{ | ||
//mHtml->beginCommand( tr( "Url changed" ) ); | ||
mHtml->setUrl( QUrl( mUrlLineEdit->text() ) ); | ||
mHtml->update(); | ||
//mHtmlItem->endCommand(); | ||
} | ||
} | ||
|
||
void QgsComposerHtmlWidget::on_mFileToolButton_clicked() | ||
{ | ||
QString file = QFileDialog::getOpenFileName( this, tr( "Select HTML document" ), QString(), "HTML (*.html)" ); | ||
if ( !file.isEmpty() ) | ||
{ | ||
QUrl url = QUrl::fromLocalFile( file ); | ||
//mHtmlItem->beginCommand( tr( "Url changed" ) ); | ||
mHtml->setUrl( url ); | ||
//mHtmlItem->endCommand(); | ||
mUrlLineEdit->setText( url.toString() ); | ||
} | ||
} | ||
|
||
void QgsComposerHtmlWidget::on_mResizeModeComboBox_currentIndexChanged( int index ) | ||
{ | ||
if ( !mHtml ) | ||
{ | ||
return; | ||
} | ||
|
||
mHtml->setResizeMode(( QgsComposerMultiFrame::ResizeMode )mResizeModeComboBox->itemData( index ).toInt() ); | ||
} | ||
|
||
void QgsComposerHtmlWidget::setGuiElementValues() | ||
{ | ||
if ( !mHtml ) | ||
{ | ||
return; | ||
} | ||
|
||
blockSignals( true ); | ||
mUrlLineEdit->setText( mHtml->url().toString() ); | ||
mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mHtml->resizeMode() ) ); | ||
blockSignals( 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,30 @@ | ||
#ifndef QGSCOMPOSERHTMLWIDGET_H | ||
#define QGSCOMPOSERHTMLWIDGET_H | ||
|
||
#include "ui_qgscomposerhtmlwidgetbase.h" | ||
|
||
class QgsComposerHtml; | ||
|
||
class QgsComposerHtmlWidget: public QWidget, private Ui::QgsComposerHtmlWidgetBase | ||
{ | ||
Q_OBJECT | ||
public: | ||
QgsComposerHtmlWidget( QgsComposerHtml* html ); | ||
~QgsComposerHtmlWidget(); | ||
|
||
private slots: | ||
void on_mUrlLineEdit_editingFinished(); | ||
void on_mFileToolButton_clicked(); | ||
void on_mResizeModeComboBox_currentIndexChanged( int index ); | ||
|
||
/**Sets the GUI elements to the values of mHtmlItem*/ | ||
void setGuiElementValues(); | ||
|
||
private: | ||
QgsComposerHtmlWidget(); | ||
void blockSignals( bool block ); | ||
|
||
QgsComposerHtml* mHtml; | ||
}; | ||
|
||
#endif // QGSCOMPOSERHTMLWIDGET_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
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
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,70 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsComposerHtmlWidgetBase</class> | ||
<widget class="QWidget" name="QgsComposerHtmlWidgetBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>243</width> | ||
<height>116</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout_2"> | ||
<item row="0" column="0"> | ||
<widget class="QToolBox" name="mToolBox"> | ||
<property name="currentIndex"> | ||
<number>0</number> | ||
</property> | ||
<widget class="QWidget" name="page"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>225</width> | ||
<height>72</height> | ||
</rect> | ||
</property> | ||
<attribute name="label"> | ||
<string>HTML</string> | ||
</attribute> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="1" column="2"> | ||
<widget class="QToolButton" name="mFileToolButton"> | ||
<property name="text"> | ||
<string>...</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1"> | ||
<widget class="QLineEdit" name="mUrlLineEdit"/> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QLabel" name="mUrlLabel"> | ||
<property name="text"> | ||
<string>URL</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="mResizeModeLabel"> | ||
<property name="text"> | ||
<string>Resize mode</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1" colspan="2"> | ||
<widget class="QComboBox" name="mResizeModeComboBox"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |