USGS

Isis 3.0 Object Programmers' Reference

Home

MosaicGridTool.cpp
1 #include "MosaicGridTool.h"
2 
3 #include <QApplication>
4 #include <QCheckBox>
5 #include <QDialog>
6 #include <QDoubleValidator>
7 #include <QGraphicsScene>
8 #include <QGridLayout>
9 #include <QLabel>
10 #include <QLineEdit>
11 #include <QMenu>
12 #include <QMessageBox>
13 #include <QPointF>
14 #include <QPushButton>
15 #include <QtCore>
16 
17 #include "Angle.h"
18 #include "Distance.h"
19 #include "FileName.h"
20 #include "GridGraphicsItem.h"
21 #include "IException.h"
22 #include "Latitude.h"
23 #include "Longitude.h"
24 #include "MosaicGraphicsView.h"
25 #include "MosaicGridToolConfigDialog.h"
26 #include "Projection.h"
27 #include "TProjection.h"
28 #include "MosaicSceneWidget.h"
29 #include "PvlObject.h"
30 
31 namespace Isis {
39  MosaicTool(scene) {
40  m_gridItem = NULL;
41 
42  if (getWidget())
43  m_previousBoundingRect = getWidget()->cubesBoundingRect();
44 
45  m_shouldCheckBoxes = true;
46 
49 
52 
56 
58  m_minLon = domainMinLon();
59  m_maxLon = domainMaxLon();
60  m_density = 10000;
61  }
62 
63 
69  void MosaicGridTool::addToMenu(QMenu *menu) {
70  }
71 
72 
79  return m_autoGridCheckBox->isChecked();
80  }
81 
82 
89  return m_baseLat;
90  }
91 
92 
99  return m_baseLon;
100  }
101 
102 
110  return m_density;
111  }
112 
113 
120  return m_latInc;
121  }
122 
123 
130  return m_latExtents;
131  }
132 
133 
140  QString result;
141 
142  if (getWidget()->getProjection()) {
143  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
144  TProjection *tproj = (TProjection *) getWidget()->getProjection();
145  result = tproj->LatitudeTypeString();
146  }
147  }
148 
149  return result;
150  }
151 
152 
159  QString result;
160 
161  if (getWidget()->getProjection()) {
162  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
163  TProjection *tproj = (TProjection *) getWidget()->getProjection();
164  result = tproj->LongitudeDomainString();
165  }
166  }
167 
168  return result;
169  }
170 
171 
178  return m_lonExtents;
179  }
180 
181 
188  return m_lonInc;
189  }
190 
191 
198  return m_maxLat;
199  }
200 
201 
208  return m_maxLon;
209  }
210 
211 
218  return m_minLat;
219  }
220 
221 
228  return m_minLon;
229  }
230 
231 
238  return getWidget();
239  }
240 
241 
248  return m_drawGridCheckBox->isChecked();
249  }
250 
251 
258  m_autoGridCheckBox->setChecked(checked);
259  }
260 
261 
268  m_baseLat = Latitude(baseLat);
269  }
270 
271 
278  m_baseLon = baseLon;
279  }
280 
281 
287  void MosaicGridTool::setDensity(int density) {
288  m_density = density;
289  }
290 
291 
300  Latitude minLat = Latitude(),
301  Latitude maxLat = Latitude()) {
302  m_latExtents = source;
303 
304  Projection *proj = getWidget()->getProjection();
305  if (proj && proj->projectionType() == Projection::Triaxial) {
306  TProjection *tproj = (TProjection *) proj;
307  PvlGroup mappingGroup(tproj->Mapping());
308 
309  Distance equatorialRadius(tproj->EquatorialRadius(),
311  Distance polarRadius(tproj->PolarRadius(), Distance::Meters);
312 
313  QRectF boundingRect = getWidget()->cubesBoundingRect();
314 
315  double topLeft = 100;
316  double topRight = 100;
317  double bottomLeft = 100;
318  double bottomRight = 100;
319  bool cubeRectWorked = true;
320 
321  switch (source) {
322 
323  case Map:
324  m_minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
325  m_maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
326  break;
327 
328  case Cubes:
329  if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
330  topLeft = tproj->Latitude();
331  }
332  else {
333  cubeRectWorked = false;
334  }
335  if (tproj->SetCoordinate(boundingRect.topRight().x(), -boundingRect.topRight().y())) {
336  topRight = tproj->Latitude();
337  }
338  else {
339  cubeRectWorked = false;
340  }
341  if (tproj->SetCoordinate(boundingRect.bottomLeft().x(), -boundingRect.bottomLeft().y())) {
342  bottomLeft = tproj->Latitude();
343  }
344  else {
345  cubeRectWorked = false;
346  }
347  if (tproj->SetCoordinate(boundingRect.bottomRight().x(),
348  -boundingRect.bottomRight().y())) {
349  bottomRight = tproj->Latitude();
350  }
351  else {
352  cubeRectWorked = false;
353  }
354 
355  if (cubeRectWorked) {
356  m_minLat = Latitude(std::min(std::min(topLeft, topRight),
357  std::min(bottomLeft, bottomRight)), mappingGroup,
359  m_maxLat = Latitude(std::max(std::max(topLeft, topRight),
360  std::max(bottomLeft, bottomRight)), mappingGroup,
362 
363  if (tproj->SetUniversalGround(-90.0, 0) &&
364  boundingRect.contains(QPointF(tproj->XCoord(), -tproj->YCoord()))) {
365  m_minLat = Latitude(-90.0, mappingGroup, Angle::Degrees);
366  }
367 
368  if (tproj->SetUniversalGround(90.0, 0) &&
369  boundingRect.contains(QPointF(tproj->XCoord(), -tproj->YCoord()))) {
370  m_maxLat = Latitude(90.0, mappingGroup, Angle::Degrees);
371  }
372  }
373  else {
374  m_minLat = Latitude(-90, mappingGroup, Angle::Degrees);
375  m_maxLat = Latitude(90, mappingGroup, Angle::Degrees);
377 
378  static Projection *lastProjWithThisError = NULL;
379 
380  if (proj != lastProjWithThisError) {
381  lastProjWithThisError = proj;
382  QMessageBox::warning(NULL, tr("Latitude Extent Failure"),
383  tr("<p/>Could not extract latitude extents from the cubes.<br/>"
384  "<br/>The option <strong>\"Compute From Images\"</strong> "
385  "will default to using the <strong>Manual</strong> option "
386  "for latitude extents with a range of -90 to 90."));
387  }
388  }
389  break;
390 
391  case Manual:
393  m_maxLat = Latitude(maxLat);
394  break;
395 
396  default:
397  m_minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
398  m_maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
399  }
400  }
401  }
402 
403 
410  if (latInc > Angle(0.0, Angle::Degrees)) {
411  m_latInc = latInc;
412  }
413  }
414 
415 
424  Longitude minLon = Longitude(),
425  Longitude maxLon = Longitude()) {
426  m_lonExtents = source;
427 
428  Projection *proj = getWidget()->getProjection();
429  if (proj && proj->projectionType() == Projection::Triaxial) {
430  TProjection * tproj = (TProjection *) proj;
431  QRectF boundingRect = getWidget()->cubesBoundingRect();
432 
433  double topLeft = 0;
434  double topRight = 0;
435  double bottomLeft = 0;
436  double bottomRight = 0;
437  bool cubeRectWorked = true;
438 
439  switch (source) {
440 
441  case Map:
444  break;
445 
446  case Cubes:
447  if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
448  topLeft = tproj->Longitude();
449  }
450  else {
451  cubeRectWorked = false;
452  }
453  if (tproj->SetCoordinate(boundingRect.topRight().x(), -boundingRect.topRight().y())) {
454  topRight = tproj->Longitude();
455  }
456  else {
457  cubeRectWorked = false;
458  }
459  if (tproj->SetCoordinate(boundingRect.bottomLeft().x(), -boundingRect.bottomLeft().y())) {
460  bottomLeft = tproj->Longitude();
461  }
462  else {
463  cubeRectWorked = false;
464  }
465  if (tproj->SetCoordinate(boundingRect.bottomRight().x(),
466  -boundingRect.bottomRight().y())) {
467  bottomRight = tproj->Longitude();
468  }
469  else {
470  cubeRectWorked = false;
471  }
472 
473  if (cubeRectWorked) {
474  m_minLon = Longitude(std::min(std::min(topLeft, topRight),
475  std::min(bottomLeft, bottomRight)),
477  m_maxLon = Longitude(std::max(std::max(topLeft, topRight),
478  std::max(bottomLeft, bottomRight)),
480  if (m_minLon < domainMinLon()) {
481  m_minLon = domainMinLon();
482  }
483  if (m_maxLon > domainMaxLon()) {
484  m_maxLon = domainMaxLon();
485  }
486  //Draw 0-360 if the pole is in the cubes' bounding rectangle.
487  if (m_minLat == Angle(-90.0, Angle::Degrees) ||
488  m_maxLat == Angle(90.0, Angle::Degrees)) {
489  m_minLon = domainMinLon();
490  m_maxLon = domainMaxLon();
491  }
492  }
493  else {
494  m_minLon = domainMinLon();
495  m_maxLon = domainMaxLon();
497 
498  static Projection *lastProjWithThisError = NULL;
499 
500  if (proj != lastProjWithThisError) {
501  lastProjWithThisError = proj;
502  QMessageBox::warning(NULL, tr("Longitude Extent Failure"),
503  tr("<p/>Could not extract longitude extents from the cubes.<br/>"
504  "<br/>The option <strong>\"Compute From Images\"</strong> "
505  "will default to using the <strong>Manual</strong> option "
506  "for longitude extents with a range of 0 to 360."));
507  }
508  }
509  break;
510 
511  case Manual:
512  m_minLon = minLon;
513  m_maxLon = maxLon;
514  break;
515 
516  default:
518  m_maxLon = Longitude(tproj->MaximumLongitude(), Angle::Degrees);
519  }
520  }
521  }
522 
523 
530  Angle lonRange = m_maxLon - m_minLon;
531 
532  if (lonInc > lonRange)
533  m_lonInc = lonRange;
534  else if (lonInc > Angle(0.0, Angle::Degrees))
535  m_lonInc = lonInc;
536  }
537 
538 
544  void MosaicGridTool::setShowGrid(bool show) {
545  m_drawGridCheckBox->setChecked(show);
546  }
547 
548 
555 
556  Projection *proj = getWidget()->getProjection();
557  if (proj && proj->projectionType() == Projection::Triaxial) {
558  TProjection *tproj = (TProjection *) proj;
559  Distance equatorialRadius(
560  tproj->EquatorialRadius(),
562  Distance polarRadius(
563  tproj->PolarRadius(), Distance::Meters);
564 
565  if (obj["BaseLatitude"][0] != "Null")
566  m_baseLat = Latitude(toDouble(obj["BaseLatitude"][0]), equatorialRadius, polarRadius,
568 
569  if (obj["BaseLongitude"][0] != "Null")
570  m_baseLon = Longitude(toDouble(obj["BaseLongitude"][0]), Angle::Degrees);
571 
572  if (obj["LatitudeIncrement"][0] != "Null")
573  m_latInc = Angle(toDouble(obj["LatitudeIncrement"][0]), Angle::Degrees);
574 
575  if (obj["LongitudeIncrement"][0] != "Null")
576  m_lonInc = Angle(toDouble(obj["LongitudeIncrement"][0]), Angle::Degrees);
577 
578  if (obj.hasKeyword("LatitudeExtentType")) {
579  if (obj["LatitudeExtentType"][0] != "Null")
580  m_latExtents = (GridExtentSource)toInt(obj["LatitudeExtentType"][0]);
581  }
582 
583  if (obj.hasKeyword("MinimumLatitude")) {
584  if (obj["MinimumLatitude"][0] != "Null")
585  m_minLat = Latitude(toDouble(obj["MinimumLatitude"][0]), equatorialRadius, polarRadius,
587  }
588 
589  if (obj.hasKeyword("MaximumLatitude")) {
590  if (obj["MaximumLatitude"][0] != "Null")
591  m_maxLat = Latitude(toDouble(obj["MaximumLatitude"][0]), equatorialRadius, polarRadius,
593  }
594 
595  if (obj.hasKeyword("LongitudeExtentType")) {
596  if (obj["LongitudeExtentType"][0] != "Null")
597  m_lonExtents = (GridExtentSource)toInt(obj["LongitudeExtentType"][0]);
598  }
599 
600  if (obj.hasKeyword("MinimumLongitude")) {
601  if (obj["MinimumLongitude"][0] != "Null")
602  m_minLon = Longitude(toDouble(obj["MinimumLongitude"][0]), Angle::Degrees);
603  }
604 
605  if (obj.hasKeyword("MaximumLongitude")) {
606  if (obj["MaximumLongitude"][0] != "Null")
607  m_maxLon = Longitude(toDouble(obj["MaximumLongitude"][0]), Angle::Degrees);
608  }
609 
610  if (obj["Density"][0] != "Null")
611  m_density = toDouble(obj["Density"][0]);
612 
613 
614  if (obj.hasKeyword("CheckTheBoxes")) {
615  if (obj["CheckTheBoxes"][0] != "Null") {
616  m_shouldCheckBoxes = (obj["CheckTheBoxes"][0] == "true");
617  }
618  }
619 
620  if(toBool(obj["Visible"][0])) {
621  drawGrid();
622  }
623  }
624  }
625 
626 
633  return "MosaicGridTool";
634  }
635 
636 
644 
645  obj += PvlKeyword("ShouldCheckBoxes", toString((int)m_shouldCheckBoxes));
646 
647  obj += PvlKeyword("BaseLatitude", toString(m_baseLat.degrees()));
648  obj += PvlKeyword("BaseLongitude", toString(m_baseLon.degrees()));
649 
650  obj += PvlKeyword("LatitudeIncrement", toString(m_latInc.degrees()));
651  obj += PvlKeyword("LongitudeIncrement", toString(m_lonInc.degrees()));
652 
653  obj += PvlKeyword("LatitudeExtentType", toString(m_latExtents));
654  obj += PvlKeyword("MaximumLatitude", toString(m_maxLat.degrees()));
655  obj += PvlKeyword("MinimumLongitude", toString(m_minLon.degrees()));
656 
657  obj += PvlKeyword("LongitudeExtentType", toString(m_lonExtents));
658  obj += PvlKeyword("MinimumLatitude", toString(m_minLat.degrees()));
659  obj += PvlKeyword("MaximumLongitude", toString(m_maxLon.degrees()));
660 
661  obj += PvlKeyword("Density", toString(m_density));
662  obj += PvlKeyword("Visible", toString((int)(m_gridItem != NULL)));
663 
664  return obj;
665  }
666 
667 
668  Longitude MosaicGridTool::domainMinLon() {
669  Longitude result;
670 
671  if (getWidget() && getWidget()->getProjection()) {
672  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
673  TProjection *tproj = (TProjection *) getWidget()->getProjection();
674  if (tproj->Has360Domain()) {
675  result = Longitude(0, Angle::Degrees);
676  }
677  else {
678  result = Longitude(-180, Angle::Degrees);
679  }
680  }
681  }
682  return result;
683  }
684 
685 
686  Longitude MosaicGridTool::domainMaxLon() {
687  Longitude result;
688 
689  if (getWidget() && getWidget()->getProjection()) {
690  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
691  TProjection *tproj = (TProjection *) getWidget()->getProjection();
692  if (tproj->Has360Domain()) {
693  result = Longitude(360, Angle::Degrees);
694  }
695  else {
696  result = Longitude(180, Angle::Degrees);
697  }
698  }
699  }
700 
701  return result;
702  }
703 
704 
710  void MosaicGridTool::autoGrid(bool draw) {
711 
712  QSettings settings(
713  FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
714  .arg(QApplication::applicationName())).expanded(),
715  QSettings::NativeFormat);
716  settings.setValue("autoGrid", draw);
717 
718  Projection *proj = getWidget()->getProjection();
719  if (draw && proj && proj->projectionType() == Projection::Triaxial) {
720  TProjection *tproj = (TProjection *) proj;
721  QRectF boundingRect = getWidget()->cubesBoundingRect();
722 
723  if (!boundingRect.isNull()) {
724 
727 
728  double latRange = m_maxLat.degrees() - m_minLat.degrees();
729 
730  if (tproj->Mapping()["LatitudeType"][0] == "Planetographic") {
731  latRange =
733  }
734 
735  double lonRange = m_maxLon.degrees() - m_minLon.degrees();
736 
737  /*
738  * To calculate the lat/lon increments we divide the range by 10 (so we end up
739  * with about 10 sections in the range, whatever the extents may be) and we
740  * divide that by 1, 10, 100,... depending on the log10 of the range. We then
741  * round this value and multiply but the same number that we divided by. This
742  * gives us a clear, sensible value for an increment.
743  *
744  * Example Increments:
745  * Range = 1 --> Inc = .1
746  * Range = 10 --> Inc = 1
747  * Range = 100 --> Inc = 10
748  * Range = 5000 --> Inc = 500
749  *
750  * inc = round[(range/10) / 10^floor(log(range) - 1)] * 10^floor(log(range) - 1)
751  */
752 
753  double latOffsetMultiplier = pow(10, qFloor(log10(latRange) - 1));
754  double lonOffsetMultiplier = pow(10, qFloor(log10(lonRange) - 1));
755 
756  double idealLatInc = latRange / 10.0;
757  double idealLonInc = lonRange / 10.0;
758 
759  double roundedLatInc = qRound(idealLatInc / latOffsetMultiplier) * latOffsetMultiplier ;
760  double roundedLonInc = qRound(idealLonInc / lonOffsetMultiplier) * lonOffsetMultiplier ;
761 
762  m_latInc = Angle(roundedLatInc, Angle::Degrees);
763  m_lonInc = Angle(roundedLonInc, Angle::Degrees);
764 
765  m_previousBoundingRect = boundingRect;
766 
767  drawGrid();
768  }
769  }
770  }
771 
772 
777  if(m_gridItem != NULL) {
778  disconnect(getWidget(), SIGNAL(projectionChanged(Projection *)),
779  this, SLOT(drawGrid()));
780 
781  getWidget()->getScene()->removeItem(m_gridItem);
782 
783  delete m_gridItem;
784  m_gridItem = NULL;
785  }
786  }
787 
788 
793  MosaicGridToolConfigDialog *configDialog =
795  qobject_cast<QWidget *>(parent()));
796  configDialog->setAttribute(Qt::WA_DeleteOnClose);
797  configDialog->show();
798  }
799 
800 
807  if(m_gridItem != NULL) {
808  m_drawGridCheckBox->setChecked(false);
809  m_autoGridCheckBox->setEnabled(true);
810  m_autoGridLabel->setEnabled(true);
811  }
812 
813  m_drawGridCheckBox->blockSignals(true);
814  m_drawGridCheckBox->setChecked(true);
815  m_drawGridCheckBox->blockSignals(false);
816 
817  if (!getWidget()->getProjection()) {
818  QString msg = "Please set the mosaic scene's projection before trying to "
819  "draw a grid. This means either open a cube (a projection "
820  "will be calculated) or set the projection explicitly";
821  QMessageBox::warning(NULL, tr("Grid Tool Requires Projection"), msg);
822  }
823 
825  m_gridItem = new GridGraphicsItem(m_baseLat, m_baseLon, m_latInc, m_lonInc, getWidget(),
827  }
828 
829  connect(getWidget(), SIGNAL(projectionChanged(Projection *)),
830  this, SLOT(drawGrid()), Qt::UniqueConnection);
831 
832  connect(getWidget(), SIGNAL(cubesChanged()),
833  this, SLOT(onCubesChanged()));
834 
835  if (m_gridItem != NULL)
836  getWidget()->getScene()->addItem(m_gridItem);
837  }
838 
839 
845  void MosaicGridTool::drawGrid(bool draw) {
846  if (draw) {
847  m_autoGridLabel->setEnabled(true);
848  m_autoGridCheckBox->setEnabled(true);
849  drawGrid();
850  }
851  else {
852  clearGrid();
853  m_autoGridLabel->setEnabled(false);
854  m_autoGridCheckBox->setEnabled(false);
855  }
856  }
857 
858 
867  if (m_previousBoundingRect != getWidget()->cubesBoundingRect()) {
868  emit boundingRectChanged();
869  autoGrid(m_autoGridCheckBox->isChecked());
870 
871  //Make sure that the grid is updated the first time new cubes are opened.
872  getWidget()->getView()->update();
873  QApplication::processEvents();
874  }
875  }
876 
877 
884  void MosaicGridTool::onToolOpen(bool check) {
885  if (check && m_shouldCheckBoxes) {
886  QSettings settings(
887  FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
888  .arg(QApplication::applicationName())).expanded(),
889  QSettings::NativeFormat);
890 
891  bool drawAuto = settings.value("autoGrid", true).toBool();
892  m_autoGridCheckBox->setChecked(drawAuto);
893 
894  // This is necessary to fully initialize properly... the auto increments should still be
895  // the default increments. This will also cause the lat/lon extents to be properly computed.
896  if (!drawAuto) {
897  autoGrid(true);
898  autoGrid(false);
899  }
900 
901  m_autoGridCheckBox->setEnabled(true);
902  m_autoGridLabel->setEnabled(true);
903  m_drawGridCheckBox->setChecked(true);
904  m_shouldCheckBoxes = false;
905  }
906  }
907 
908 
917  QWidget *widget = new QWidget();
918  return widget;
919  }
920 
921 
930  m_action = new QAction(this);
931  m_action->setIcon(getIcon("grid.png"));
932  m_action->setToolTip("Grid (g)");
933  m_action->setShortcut(Qt::Key_G);
934  QString text =
935  "<b>Function:</b> Superimpose a map grid over the area of displayed "
936  "footprints in the 'mosaic scene.'<br><br>"
937  "This tool allows you to overlay a ground grid onto the mosaic scene. "
938  "The inputs are standard ground grid parameters and a grid density."
939  "<p><b>Shortcut:</b> g</p> ";
940  m_action->setWhatsThis(text);
941  return m_action;
942  }
943 
944 
951 
952  m_previousBoundingRect = getWidget()->cubesBoundingRect();
953 
954  QHBoxLayout *actionLayout = new QHBoxLayout();
955 
956  QString autoGridWhatsThis =
957  "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
958  m_autoGridLabel = new QLabel("Auto Grid");
959  m_autoGridLabel->setWhatsThis(autoGridWhatsThis);
960  m_autoGridCheckBox = new QCheckBox;
961  m_autoGridCheckBox->setWhatsThis(autoGridWhatsThis);
962  connect(m_autoGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(autoGrid(bool)));
963  actionLayout->addWidget(m_autoGridLabel);
964  actionLayout->addWidget(m_autoGridCheckBox);
965 
966  // Create the action buttons
967  QPushButton *optionsButton = new QPushButton("Grid Options");
968  optionsButton->setWhatsThis("Opens a dialog box that has the options to change the base"
969  " latitude, base longitude, latitude increment, longitude"
970  " increment, and grid density.");
971  connect(optionsButton, SIGNAL(clicked()), this, SLOT(configure()));
972  actionLayout->addWidget(optionsButton);
973 
974  QString drawGridWhatsThis =
975  "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
976  QLabel *drawGridLabel = new QLabel("Show Grid");
977  drawGridLabel->setWhatsThis(drawGridWhatsThis);
978  m_drawGridCheckBox = new QCheckBox;
979  m_drawGridCheckBox->setWhatsThis(drawGridWhatsThis);
980  connect(m_drawGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(drawGrid(bool)));
981  actionLayout->addWidget(drawGridLabel);
982  actionLayout->addWidget(m_drawGridCheckBox);
983 
984  connect(this, SIGNAL(activated(bool)), this, SLOT(onToolOpen(bool)));
985 
986  actionLayout->addStretch(1);
987  actionLayout->setMargin(0);
988 
989  QWidget *toolBarWidget = new QWidget;
990  toolBarWidget->setLayout(actionLayout);
991 
992  return toolBarWidget;
993  }
994 }