Commit 175fad37 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Fix sizing issues with views so that they dock nicely with the other views....

Fix sizing issues with views so that they dock nicely with the other views. Fixed some history entries in Project.h that were lost in a previous merge.
parent 3fcbd4bb
Loading
Loading
Loading
Loading
+38 −11
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@


#include "AbstractProjectItemView.h"
#include "ControlHealthMonitorView.h"
#include "Directory.h"
#include "FileName.h"
#include "IException.h"
@@ -90,7 +91,6 @@ namespace Isis {
    // Allows a user to undock a group of tabs.
    //setDockOptions(GroupedDragging | AllowTabbedDocks);

    //centralWidget->hide();
    setDockNestingEnabled(true);

    //  Set the splitter frames to a reasonable color/size for resizing the docks.
@@ -128,7 +128,6 @@ namespace Isis {
    projectTreeView->setInternalModel( m_directory->model() );
    projectTreeView->treeView()->expandAll();
    projectTreeView->installEventFilter(this);
    //projectTreeView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    m_projectDock->setWidget(projectTreeView);
    addDockWidget(Qt::LeftDockWidgetArea, m_projectDock, Qt::Horizontal);
@@ -157,8 +156,6 @@ namespace Isis {

    historyDock->raise();

    setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North);

    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea);
@@ -196,9 +193,13 @@ namespace Isis {
   */
  void IpceMainWindow::addView(QWidget *newWidget, Qt::DockWidgetArea area,
                               Qt::Orientation orientation) {

    // JigsawRunWidget is already a QDockWidget, and no modifications need to be made to it
    if (qobject_cast<JigsawRunWidget *>(newWidget)) {
      splitDockWidget(m_projectDock, (QDockWidget*)newWidget, Qt::Vertical);

      // Save view docks for cleanup during a project close
      m_specialDocks.append((QDockWidget *)newWidget);
      return;
    }

@@ -211,22 +212,32 @@ namespace Isis {

    if ( qobject_cast<SensorInfoWidget *>(newWidget) ||
         qobject_cast<TargetInfoWidget *>(newWidget) ||
         qobject_cast<ControlHealthMonitorView *>(newWidget) ||
         qobject_cast<TemplateEditorWidget *>(newWidget)) {
      dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
      splitDockWidget(m_projectDock, dock, Qt::Vertical);

      // Save view docks for cleanup during a project close
      m_specialDocks.append(dock);
    }
    else {
      // The following logic not guaranteed to work as intented. If user moves one of the "special"
      // views such as sensor from below the project dock to the right side of project, the following
      // will put the new dock to the right of the moved "special" dock instead of tabbing.  The only
      // way to possibly insure the intended functionality would be to check for the position of the
      // last added dock and either add or tabify depending on location.  This might also allow the
      // docks to be kept in a single list instead of m_specialDocks & m_viewDocks.
      if (m_viewDocks.count() == 0) {
        splitDockWidget(m_projectDock, dock, Qt::Horizontal);
        addDockWidget(Qt::RightDockWidgetArea, dock, Qt::Horizontal);
      }
      else {
        tabifyDockWidget(m_viewDocks.last(), dock);
        dock->show();
        dock->raise();
        //  Keeps expanding IpceMainWindow to fit new dock
        //  Below causes problems if the last dock has been tabbed, then a new view is created. All
        // views except for first disappear.
        //splitDockWidget(m_viewDocks.last(), dock, Qt::Horizontal);
      }

      // Save view docks for cleanup during a project close
      m_viewDocks.append(dock);
    }

    // When dock widget is destroyed, make sure the view it holds is also destroyed
@@ -234,8 +245,14 @@ namespace Isis {
    // The list of dock widgets needs cleanup as each view is destroyed
    connect(dock, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupViewDockList(QObject *)));

    // Save view docks for cleanup during a project close
    m_viewDocks.append(dock);
    // Redmine #5471 TODO Hiding the centralWidget in this constructor gets rid of the space which
    // is a place holder for the dumy centralWidget, which causes the project view to fill the space
    // horizontally and the history/warning widgets are show much larger vertically and user is not
    // able to make smaller. Attempts to change the sizePolicy on the history/warning widgets did
    // not fix this (see Directory::setHistoryContainer, Directory::setWarningContainer.  Calling
    // hide here keeps the project tree view smaller until a view is shown, however, the history/
    // warning widgets are still too large vertically.
    // centralWidget()->hide();
  }


@@ -244,6 +261,7 @@ namespace Isis {
    QDockWidget *dock = static_cast<QDockWidget *>(obj);
    if (dock) {
      m_viewDocks.removeAll(dock);
      m_specialDocks.removeAll(dock);
    }
  }

@@ -274,7 +292,16 @@ namespace Isis {
        delete dock;
      }
    }

    foreach (QDockWidget *dock, m_specialDocks) {
      if (dock) {
        removeDockWidget(dock);
        m_specialDocks.removeAll(dock);
        delete dock;
      }
    }
    m_viewDocks.clear();
    m_specialDocks.clear();
  }


+7 −0
Original line number Diff line number Diff line
@@ -195,6 +195,12 @@ namespace Isis {
   *                           geometry to be saved if the config file does not exist and a user
   *                           opens a project. Before, it would not save the geometry because the
   *                           opened project was not temporary. References #5433
   *   @history 2018-07-19 Tracie Sucharski - Keep separate dock lists for the view docks and
   *                           "special" docks such as sensor, target and jigsaw. Changed the
   *                           addDocks to the right dock area which fixes some of the odd behavior
   *                           with docking, but does show the empty centralWidget between the
   *                           project view and the newly added view if the ipce mainWindow is not
   *                           fullscreen.
   */
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
@@ -247,6 +253,7 @@ namespace Isis {
      QDockWidget *m_projectDock;
      QDockWidget *m_warningsDock;

      QList<QDockWidget *> m_specialDocks;  //!< Non-view dock widgets such as jigsawRun
      QList<QDockWidget *> m_viewDocks; //!< QDockWidgets holding the views

      /**
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ namespace Isis {
   */
  QSize AbstractProjectItemView::sizeHint() const {

    //  Size hint is made ridiculously large as a hack to have the views fill the available dock
    //  Size hint is made large as a hack to have the views fill the available dock
    //  space. SizePolicy alone did not work.
    QDesktopWidget deskTop;
    QRect availableSpace = deskTop.availableGeometry(deskTop.primaryScreen());
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ namespace Isis {
   *                           size, instead of being hard-coded. The percentages chosen allow for 2
   *                           CubeDnViews to be opened at once, since CubeDnView has an internal
   *                           size policy. References #5433
   *   @history 2018-07-26 Tracie Sucharski - Cleaned up some documentation. 
   */
  class AbstractProjectItemView : public QMainWindow {

+12 −0
Original line number Diff line number Diff line
@@ -88,8 +88,20 @@ namespace Isis {
    m_activeToolBarAction->setDefaultWidget(m_activeToolBar);

    setAcceptDrops(true);

    //setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
  }


///**
// * Return a reasonable size
// */
//QSize ControlHealthMonitorView::sizeHint() const {
//
//  return QSize(500, 700);
//}


  /**
   *  This SLOT is designed to intercept the openPointEditor() signal that's emitted
   *  Whenever a point is double clicked on inside of the ControlHealthMonitorWidget.
Loading