Skip to content

Commit

Permalink
- horizontal scroll bars for tree views
Browse files Browse the repository at this point in the history
- removed an extra progressbar during simulation.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10273 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Nov 2, 2011
1 parent 3999e62 commit e3c8d66
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 14 deletions.
27 changes: 22 additions & 5 deletions OMEdit/OMEditGUI/LibraryWidget.cpp
Expand Up @@ -591,6 +591,7 @@ LibraryTree::LibraryTree(LibraryWidget *pParent)
createActions();

connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(expandLib(QTreeWidgetItem*)));
connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(collapseLib(QTreeWidgetItem*)));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
}

Expand Down Expand Up @@ -803,6 +804,15 @@ void LibraryTree::expandLib(QTreeWidgetItem *item)
// Remove the wait cursor
unsetCursor();
}
resizeColumnToContents(0);
}

//! Makes a library collapse.
//! @param item is the library to collapse.
void LibraryTree::collapseLib(QTreeWidgetItem *item)
{
Q_UNUSED(item);
resizeColumnToContents(0);
}

void LibraryTree::showContextMenu(QPoint point)
Expand Down Expand Up @@ -1334,20 +1344,19 @@ LibraryWidget::LibraryWidget(MainWindow *parent)
: QWidget(parent)
{
mpParentMainWindow = parent;

// create tab widget for libraries
mpLibraryTabs = new QTabWidget;
mpLibraryTabs->setTabPosition(QTabWidget::South);

// create libraries
mpLibraryTree = new LibraryTree(this);
mpModelicaTree = new ModelicaTree(this);

// Add libraries to tabs
mpLibraryTabs->addTab(mpLibraryTree, "Modelica Library");
mpLibraryTabs->addTab(mpModelicaTree, "Modelica Files");

// set the layout
mpGrid = new QVBoxLayout(this);
mpGrid->setContentsMargins(0, 0, 0, 0);
mpGrid->addWidget(mpLibraryTabs);

setLayout(mpGrid);
}

Expand Down Expand Up @@ -1621,6 +1630,7 @@ ModelBrowserTree::ModelBrowserTree(ModelBrowserWidget *parent)

connect(mpParentModelBrowserWidget, SIGNAL(addModelBrowserTreeNode()), SLOT(editModelBrowser()));
connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(expandTree(QTreeWidgetItem*)));
connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(collapseTree(QTreeWidgetItem*)));
}
ModelBrowserTree::~ModelBrowserTree()
{
Expand Down Expand Up @@ -1736,6 +1746,13 @@ void ModelBrowserTree::expandTree(QTreeWidgetItem *item)
{
item->setExpanded(true);
}
resizeColumnToContents(0);
}

void ModelBrowserTree::collapseTree(QTreeWidgetItem *item)
{
Q_UNUSED(item);
resizeColumnToContents(0);
}

ModelBrowserWidget::ModelBrowserWidget(MainWindow *parent)
Expand Down
3 changes: 2 additions & 1 deletion OMEdit/OMEditGUI/LibraryWidget.h
Expand Up @@ -153,6 +153,7 @@ class LibraryTree : public QTreeWidget
LibraryWidget *mpParentLibraryWidget;
private slots:
void expandLib(QTreeWidgetItem *item);
void collapseLib(QTreeWidgetItem *item);
void showContextMenu(QPoint point);
void showComponent(QTreeWidgetItem *item, int column);
void showComponent();
Expand Down Expand Up @@ -333,7 +334,7 @@ class ModelBrowserTree : public QTreeWidget
QList<ModelBrowserTreeNode*> mModelBrowserTreeNodeList;
private slots:
void expandTree(QTreeWidgetItem *item);

void collapseTree(QTreeWidgetItem *item);
public slots:
void editModelBrowser();
};
Expand Down
17 changes: 16 additions & 1 deletion OMEdit/OMEditGUI/PlotWidget.cpp
Expand Up @@ -103,6 +103,9 @@ PlotTree::PlotTree(PlotWidget *pParent)
setIndentation(Helper::treeIndentation);
setContextMenuPolicy(Qt::CustomContextMenu);
setExpandsOnDoubleClick(false);

connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(expandNode(QTreeWidgetItem*)));
connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(collapseNode(QTreeWidgetItem*)));
}

PlotTreeItem* PlotTree::getTreeItem(QString name)
Expand All @@ -125,6 +128,18 @@ PlotWidget* PlotTree::getPlotWidget()
return mpParentPlotWidget;
}

void PlotTree::expandNode(QTreeWidgetItem *item)
{
Q_UNUSED(item);
resizeColumnToContents(0);
}

void PlotTree::collapseNode(QTreeWidgetItem *item)
{
Q_UNUSED(item);
resizeColumnToContents(0);
}

PlotWidget::PlotWidget(MainWindow *pParent)
: QWidget(pParent)
{
Expand Down Expand Up @@ -293,7 +308,7 @@ void PlotWidget::addPlotVariableToTree(QString fileName, QString parentStructure
PlotTreeItem *parentItem = mpPlotTree->getTreeItem(parentStructure);
QString toolTip = QString("File: ").append(fileName).append("\nVariable: ").append(childName);
PlotTreeItem *newTreePost = new PlotTreeItem(childName, parentItem->getName(), nameStructure, fileName, toolTip, (QTreeWidget*)0);
newTreePost->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
newTreePost->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
newTreePost->setCheckState(0, Qt::Unchecked);
if (parentItem)
{
Expand Down
4 changes: 4 additions & 0 deletions OMEdit/OMEditGUI/PlotWidget.h
Expand Up @@ -62,12 +62,16 @@ class PlotWidget;

class PlotTree : public QTreeWidget
{
Q_OBJECT
public:
PlotTree(PlotWidget *pParent);
PlotTreeItem* getTreeItem(QString name);
PlotWidget* getPlotWidget();
private:
PlotWidget *mpParentPlotWidget;
private slots:
void expandNode(QTreeWidgetItem *item);
void collapseNode(QTreeWidgetItem *item);
};

class PlotWidget : public QWidget
Expand Down
11 changes: 7 additions & 4 deletions OMEdit/OMEditGUI/Resources/css/stylesheet.qss
Expand Up @@ -53,10 +53,6 @@ QStatusBar#ProjectStatusBar QLabel {
padding: 0px 0px 0px 1px;
}

QPushButton#ModelicaEditorSearchButtons {

}

QToolButton#InteractiveSimulationButtons {
padding: 3px;
}
Expand All @@ -69,3 +65,10 @@ QListWidget#RecentItemsList::item:hover {
QWidget#DocumentationWidget {
border: 1px solid gray;
}

QTabBar::scroller { /* the width of the scroll buttons */
width: 15px;
}
QTabBar QToolButton { /* the scroll buttons are tool buttons */
background-color: palette(window);
}
3 changes: 0 additions & 3 deletions OMEdit/OMEditGUI/SimulationWidget.cpp
Expand Up @@ -273,8 +273,6 @@ void SimulationWidget::simulate()
mpProgressDialog->getProgressBar()->setRange(0, 0);
mpProgressDialog->getProgressBar()->setTextVisible(false);
mpProgressDialog->show();
mpParentMainWindow->mpProgressBar->setRange(0, 0);
mpParentMainWindow->showProgressBar();
mpParentMainWindow->mpStatusBar->showMessage(Helper::compiling_Model);
// interactive or non interactive
if (mIsInteractive)
Expand All @@ -283,7 +281,6 @@ void SimulationWidget::simulate()
simulateModel(simualtionParameters);
// hide the progress bar
mpParentMainWindow->mpStatusBar->clearMessage();
mpParentMainWindow->hideProgressBar();
mpProgressDialog->hide();
accept();
}
Expand Down

0 comments on commit e3c8d66

Please sign in to comment.