Skip to content

Commit 10e070a

Browse files
author
timlinux
committed
Gui cleanups to main app window:
- changed the order of the digitising icons for better logical grouping - resolve status bar issues on mac by forcing heights of all status bar elements to max 20px - removed some redundant code for stopping rendering git-svn-id: http://svn.osgeo.org/qgis/trunk@8490 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 78da8bc commit 10e070a

File tree

2 files changed

+53
-49
lines changed

2 files changed

+53
-49
lines changed

src/app/qgisapp.cpp

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,15 +1068,15 @@ void QgisApp::createToolBars()
10681068
mDigitizeToolBar->addAction(mActionCapturePolygon);
10691069
mDigitizeToolBar->addAction(mActionAddRing);
10701070
mDigitizeToolBar->addAction(mActionAddIsland);
1071-
mDigitizeToolBar->addAction(mActionMoveFeature);
1072-
mDigitizeToolBar->addAction(mActionSplitFeatures);
10731071
mDigitizeToolBar->addAction(mActionDeleteSelected);
1074-
mDigitizeToolBar->addAction(mActionAddVertex);
1075-
mDigitizeToolBar->addAction(mActionDeleteVertex);
1076-
mDigitizeToolBar->addAction(mActionMoveVertex);
10771072
mDigitizeToolBar->addAction(mActionEditCut);
10781073
mDigitizeToolBar->addAction(mActionEditCopy);
10791074
mDigitizeToolBar->addAction(mActionEditPaste);
1075+
mDigitizeToolBar->addAction(mActionSplitFeatures);
1076+
mDigitizeToolBar->addAction(mActionMoveFeature);
1077+
mDigitizeToolBar->addAction(mActionMoveVertex);
1078+
mDigitizeToolBar->addAction(mActionAddVertex);
1079+
mDigitizeToolBar->addAction(mActionDeleteVertex);
10801080
//
10811081
// Map Navigation Toolbar
10821082
mMapNavToolBar = addToolBar(tr("Map Navigation"));
@@ -1126,29 +1126,23 @@ void QgisApp::createStatusBar()
11261126
// Add a panel to the status bar for the scale, coords and progress
11271127
// And also rendering suppression checkbox
11281128
//
1129-
1130-
1131-
11321129
mProgressBar = new QProgressBar(statusBar());
11331130
mProgressBar->setMaximumWidth(100);
11341131
mProgressBar->hide();
1135-
mProgressBar->setWhatsThis(tr("Progress bar that displays the status of rendering layers and other time-intensive operations"));
1132+
mProgressBar->setWhatsThis(tr("Progress bar that displays the status"
1133+
"of rendering layers and other time-intensive operations"));
11361134
statusBar()->addWidget(mProgressBar, 1,true);
11371135
// Bumped the font up one point size since 8 was too
11381136
// small on some platforms. A point size of 9 still provides
11391137
// plenty of display space on 1024x768 resolutions
11401138
QFont myFont( "Arial", 9 );
11411139

1142-
mStopRenderButton = new QPushButton(tr("Stop rendering"), statusBar());
1143-
#ifdef Q_WS_MAC //MH: disable the button on Mac for now to avoid problems with resizing
1144-
mStopRenderButton->setEnabled(false);
1145-
#endif //Q_WS_MAC
1146-
statusBar()->addWidget(mStopRenderButton, 0, true);
11471140

11481141
statusBar()->setFont(myFont);
11491142
mScaleLabel = new QLabel(QString(),statusBar());
11501143
mScaleLabel->setFont(myFont);
11511144
mScaleLabel->setMinimumWidth(10);
1145+
mScaleLabel->setMaximumHeight(20);
11521146
mScaleLabel->setMargin(3);
11531147
mScaleLabel->setAlignment(Qt::AlignCenter);
11541148
mScaleLabel->setFrameStyle(QFrame::NoFrame);
@@ -1160,6 +1154,7 @@ void QgisApp::createStatusBar()
11601154
mScaleEdit->setFont(myFont);
11611155
mScaleEdit->setMinimumWidth(10);
11621156
mScaleEdit->setMaximumWidth(100);
1157+
mScaleEdit->setMaximumHeight(20);
11631158
mScaleEdit->setMargin(0);
11641159
mScaleEdit->setAlignment(Qt::AlignLeft);
11651160
QRegExp validator("\\d+\\.?\\d*:\\d+\\.?\\d*");
@@ -1173,17 +1168,31 @@ void QgisApp::createStatusBar()
11731168
//coords status bar widget
11741169
mCoordsLabel = new QLabel(QString(), statusBar());
11751170
mCoordsLabel->setMinimumWidth(10);
1171+
mCoordsLabel->setMaximumHeight(20);
11761172
mCoordsLabel->setFont(myFont);
11771173
mCoordsLabel->setMargin(3);
11781174
mCoordsLabel->setAlignment(Qt::AlignCenter);
1179-
mCoordsLabel->setWhatsThis(tr("Shows the map coordinates at the current cursor position. The display is continuously updated as the mouse is moved."));
1175+
mCoordsLabel->setWhatsThis(tr("Shows the map coordinates at the"
1176+
"current cursor position. The display is continuously updated "
1177+
"as the mouse is moved."));
11801178
mCoordsLabel->setToolTip(tr("Map coordinates at mouse cursor position"));
11811179
statusBar()->addWidget(mCoordsLabel, 0, true);
1180+
//stop rendering status bar widget
1181+
mStopRenderButton = new QToolButton( statusBar() );
1182+
mStopRenderButton->setMaximumWidth(20);
1183+
mStopRenderButton->setMaximumHeight(20);
1184+
//#ifdef Q_WS_MAC //MH: disable the button on Mac for now to avoid problems with resizing
1185+
mStopRenderButton->setEnabled(false);
1186+
//#endif //Q_WS_MAC
1187+
statusBar()->addWidget(mStopRenderButton, 0, true);
11821188
// render suppression status bar widget
11831189
mRenderSuppressionCBox = new QCheckBox(tr("Render"),statusBar());
11841190
mRenderSuppressionCBox->setChecked(true);
11851191
mRenderSuppressionCBox->setFont(myFont);
1186-
mRenderSuppressionCBox->setWhatsThis(tr("When checked, the map layers are rendered in response to map navigation commands and other events. When not checked, no rendering is done. This allows you to add a large number of layers and symbolize them before rendering."));
1192+
mRenderSuppressionCBox->setWhatsThis(tr("When checked, the map layers "
1193+
"are rendered in response to map navigation commands and other "
1194+
"events. When not checked, no rendering is done. This allows you "
1195+
"to add a large number of layers and symbolize them before rendering."));
11871196
mRenderSuppressionCBox->setToolTip(tr("Toggle map rendering") );
11881197
statusBar()->addWidget(mRenderSuppressionCBox,0,true);
11891198
// On the fly projection status bar icon
@@ -1203,11 +1212,13 @@ void QgisApp::createStatusBar()
12031212
{
12041213
QMessageBox::critical(this, tr("Resource Location Error"),
12051214
tr("Error reading icon resources from: \n %1\n Quitting...").arg(myIconPath));
1206-
12071215
exit(0);
12081216
}
1209-
mOnTheFlyProjectionStatusButton->setWhatsThis(tr("This icon shows whether on the fly projection is enabled or not. Click the icon to bring up the project properties dialog to alter this behaviour."));
1210-
mOnTheFlyProjectionStatusButton->setToolTip(tr("Projection status - Click to open projection dialog"));
1217+
mOnTheFlyProjectionStatusButton->setWhatsThis(tr("This icon shows whether "
1218+
"on the fly projection is enabled or not. Click the icon to bring up "
1219+
"the project properties dialog to alter this behaviour."));
1220+
mOnTheFlyProjectionStatusButton->setToolTip(tr("Projection status - Click "
1221+
"to open projection dialog"));
12111222
connect(mOnTheFlyProjectionStatusButton, SIGNAL(clicked()),
12121223
this, SLOT(projectPropertiesProjections()));//bring up the project props dialog when clicked
12131224
statusBar()->addWidget(mOnTheFlyProjectionStatusButton,0,true);
@@ -1305,7 +1316,6 @@ void QgisApp::setupConnections()
13051316
mMapLegend, SLOT(removeAll()));
13061317
connect(QgsMapLayerRegistry::instance(), SIGNAL(layerWasAdded(QgsMapLayer*)),
13071318
mMapLegend, SLOT(addLayer(QgsMapLayer *)));
1308-
13091319
connect(mMapLegend, SIGNAL(currentLayerChanged(QgsMapLayer*)),
13101320
this, SLOT(activateDeactivateLayerRelatedActions(QgsMapLayer*)));
13111321

@@ -1321,6 +1331,9 @@ void QgisApp::setupConnections()
13211331
connect(mMapCanvas, SIGNAL(scaleChanged(double)), this, SLOT(updateMouseCoordinatePrecision()));
13221332

13231333
connect(mRenderSuppressionCBox, SIGNAL(toggled(bool )), mMapCanvas, SLOT(setRenderFlag(bool)));
1334+
//
1335+
// Do we really need this ??? - its already connected to the esc key...TS
1336+
//
13241337
connect(mStopRenderButton, SIGNAL(clicked()), this, SLOT(stopRendering()));
13251338

13261339
// Connect warning dialog from project reading
@@ -1332,7 +1345,8 @@ void QgisApp::createCanvas()
13321345
{
13331346
// "theMapCanvas" used to find this canonical instance later
13341347
mMapCanvas = new QgsMapCanvas(this, "theMapCanvas" );
1335-
mMapCanvas->setWhatsThis(tr("Map canvas. This is where raster and vector layers are displayed when added to the map"));
1348+
mMapCanvas->setWhatsThis(tr("Map canvas. This is where raster and vector"
1349+
"layers are displayed when added to the map"));
13361350

13371351
// mMapCanvas->setMinimumWidth(10);
13381352
// QVBoxLayout *myCanvasLayout = new QVBoxLayout;
@@ -1631,6 +1645,7 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
16311645
{
16321646
QSettings mySettings;
16331647

1648+
QgsApplication::showSettings();
16341649
QgsDebugMsg("\n\n*************************************************");
16351650
QgsDebugMsg("Restoring plugins from last session " + thePluginDirString);
16361651

@@ -3304,17 +3319,17 @@ void QgisApp::toggleFullScreen()
33043319
void QgisApp::stopRendering()
33053320
{
33063321
if(mMapCanvas)
3322+
{
3323+
QgsMapRender* mypMapRender = mMapCanvas->mapRender();
3324+
if(mypMapRender)
33073325
{
3308-
QgsMapRender* mapRender = mMapCanvas->mapRender();
3309-
if(mapRender)
3310-
{
3311-
QgsRenderContext* renderContext = mapRender->renderContext();
3312-
if(renderContext)
3313-
{
3314-
renderContext->setRenderingStopped(true);
3315-
}
3316-
}
3326+
QgsRenderContext* mypRenderContext = mypMapRender->renderContext();
3327+
if(mypRenderContext)
3328+
{
3329+
mypRenderContext->setRenderingStopped(true);
3330+
}
33173331
}
3332+
}
33183333
}
33193334

33203335
//reimplements method from base (gui) class
@@ -5340,27 +5355,16 @@ void QgisApp::keyPressEvent ( QKeyEvent * e )
53405355
// commented out for now. [gsherman]
53415356
// std::cout << e->text().toLocal8Bit().data() << " (keypress recevied)" << std::endl;
53425357
emit keyPressed (e);
5343-
5358+
53445359
//cancel rendering progress with esc key
53455360
if(e->key() == Qt::Key_Escape)
5346-
{
5347-
if(mMapCanvas)
5348-
{
5349-
QgsMapRender* theMapRender = mMapCanvas->mapRender();
5350-
if(theMapRender)
5351-
{
5352-
QgsRenderContext* theRenderContext = theMapRender->renderContext();
5353-
if(theRenderContext)
5354-
{
5355-
theRenderContext->setRenderingStopped(true);
5356-
}
5357-
}
5358-
}
5359-
}
5361+
{
5362+
stopRendering();
5363+
}
53605364
else
5361-
{
5362-
e->ignore();
5363-
}
5365+
{
5366+
e->ignore();
5367+
}
53645368
}
53655369

53665370
// Debug hook - used to output diagnostic messages when evoked (usually from the menu)

src/app/qgisapp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ class Tools
581581
//! Widget used to suppress rendering
582582
QCheckBox * mRenderSuppressionCBox;
583583
//! Button used to stop rendering
584-
QPushButton* mStopRenderButton;
584+
QToolButton* mStopRenderButton;
585585
//! Widget in status bar used to show status of on the fly projection
586586
QToolButton * mOnTheFlyProjectionStatusButton;
587587
//! Popup menu

0 commit comments

Comments
 (0)