Skip to content

Commit 5f02bc4

Browse files
committed
Set better window titles for svg annotation
1 parent 463dec7 commit 5f02bc4

File tree

2 files changed

+40
-39
lines changed

2 files changed

+40
-39
lines changed

src/app/qgssvgannotationdialog.cpp

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,25 @@
2222
#include <QFileInfo>
2323
#include <QGraphicsScene>
2424

25-
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent, Qt::WindowFlags f):
25+
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ):
2626
QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 )
2727
{
28-
setupUi( this );
29-
mEmbeddedWidget = new QgsAnnotationWidget( mItem );
30-
mEmbeddedWidget->show();
31-
mStackedWidget->addWidget( mEmbeddedWidget );
32-
mStackedWidget->setCurrentWidget( mEmbeddedWidget );
28+
setupUi( this );
29+
setWindowTitle( tr( "SVG annotation" ) );
30+
mEmbeddedWidget = new QgsAnnotationWidget( mItem );
31+
mEmbeddedWidget->show();
32+
mStackedWidget->addWidget( mEmbeddedWidget );
33+
mStackedWidget->setCurrentWidget( mEmbeddedWidget );
3334

34-
if( mItem )
35-
{
36-
mFileLineEdit->setText( mItem->filePath() );
37-
}
35+
if ( mItem )
36+
{
37+
mFileLineEdit->setText( mItem->filePath() );
38+
}
3839

39-
QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
40-
QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
41-
QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
42-
mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
40+
QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
41+
QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
42+
QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
43+
mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
4344
}
4445

4546
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog(): QDialog(), mItem( 0 ), mEmbeddedWidget( 0 )
@@ -54,38 +55,38 @@ QgsSvgAnnotationDialog::~QgsSvgAnnotationDialog()
5455

5556
void QgsSvgAnnotationDialog::on_mBrowseToolButton_clicked()
5657
{
57-
QString directory;
58-
QFileInfo fi( mFileLineEdit->text() );
59-
if ( fi.exists() )
60-
{
61-
directory = fi.absolutePath();
62-
}
63-
QString filename = QFileDialog::getOpenFileName( 0, tr( "html" ), directory, "*.html" );
64-
mFileLineEdit->setText( filename );
58+
QString directory;
59+
QFileInfo fi( mFileLineEdit->text() );
60+
if ( fi.exists() )
61+
{
62+
directory = fi.absolutePath();
63+
}
64+
QString filename = QFileDialog::getOpenFileName( 0, tr( "Select SVG file" ), directory, tr( "SVG files" ) + " (*.svg)" );
65+
mFileLineEdit->setText( filename );
6566
}
6667

6768
void QgsSvgAnnotationDialog::applySettingsToItem()
6869
{
69-
if ( mEmbeddedWidget )
70-
{
71-
mEmbeddedWidget->apply();
72-
}
70+
if ( mEmbeddedWidget )
71+
{
72+
mEmbeddedWidget->apply();
73+
}
7374

74-
if( mItem )
75-
{
76-
mItem->setFilePath( mFileLineEdit->text() );
77-
mItem->update();
78-
}
75+
if ( mItem )
76+
{
77+
mItem->setFilePath( mFileLineEdit->text() );
78+
mItem->update();
79+
}
7980

8081
}
8182

8283
void QgsSvgAnnotationDialog::deleteItem()
8384
{
84-
QGraphicsScene* scene = mItem->scene();
85-
if ( scene )
86-
{
87-
scene->removeItem( mItem );
88-
}
89-
delete mItem;
90-
mItem = 0;
85+
QGraphicsScene* scene = mItem->scene();
86+
if ( scene )
87+
{
88+
scene->removeItem( mItem );
89+
}
90+
delete mItem;
91+
mItem = 0;
9192
}

src/ui/qgsformannotationdialogbase.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
14-
<string>Dialog</string>
14+
<string>Form annotation</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout">
1717
<item row="0" column="0">

0 commit comments

Comments
 (0)