Skip to content
Snippets Groups Projects
Unverified Commit 1500ca7c authored by Walter Van Herck's avatar Walter Van Herck Committed by GitHub
Browse files

Merge branch 'release-1.11.0' into release-1.11.0

parents ad0b88e9 f4dc165a
No related branches found
No related tags found
No related merge requests found
Showing with 61 additions and 32 deletions
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "DistributionDialog.h" #include "DistributionDialog.h"
#include "DistributionEditor.h" #include "DistributionEditor.h"
#include "SessionItem.h" #include "SessionItem.h"
#include "StyleUtils.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QPushButton> #include <QPushButton>
...@@ -45,6 +46,7 @@ DistributionDialog::DistributionDialog(QWidget *parent) ...@@ -45,6 +46,7 @@ DistributionDialog::DistributionDialog(QWidget *parent)
setLayout(layout); setLayout(layout);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
StyleUtils::setResizable(this);
} }
void DistributionDialog::setItem(SessionItem *item) void DistributionDialog::setItem(SessionItem *item)
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
namespace { namespace {
const int replot_update_interval = 10; const int replot_update_interval = 10;
const int colorbar_width_logz = 50;
const int colorbar_width = 80;
} }
ColorMap::ColorMap(QWidget* parent) ColorMap::ColorMap(QWidget* parent)
...@@ -31,7 +33,8 @@ ColorMap::ColorMap(QWidget* parent) ...@@ -31,7 +33,8 @@ ColorMap::ColorMap(QWidget* parent)
, m_colorMap(nullptr), m_colorScale(nullptr) , m_colorMap(nullptr), m_colorScale(nullptr)
, m_updateTimer(new UpdateTimer(replot_update_interval, this)) , m_updateTimer(new UpdateTimer(replot_update_interval, this))
, m_colorMapEvent(new ColorMapEvent(this)) , m_colorMapEvent(new ColorMapEvent(this))
, m_block_update(true) , m_colorBarLayout(new QCPLayoutGrid)
, m_block_update(true)
{ {
initColorMap(); initColorMap();
...@@ -118,6 +121,7 @@ void ColorMap::setMouseTrackingEnabled(bool enable) ...@@ -118,6 +121,7 @@ void ColorMap::setMouseTrackingEnabled(bool enable)
//! sets logarithmic scale //! sets logarithmic scale
void ColorMap::setLogz(bool logz) void ColorMap::setLogz(bool logz)
{ {
m_colorBarLayout->setMinimumSize(logz ? colorbar_width_logz : colorbar_width,10);
ColorMapUtils::setLogz(m_colorScale, logz); ColorMapUtils::setLogz(m_colorScale, logz);
} }
...@@ -269,6 +273,13 @@ void ColorMap::initColorMap() ...@@ -269,6 +273,13 @@ void ColorMap::initColorMap()
m_colorScale = new QCPColorScale(m_customPlot); m_colorScale = new QCPColorScale(m_customPlot);
m_colorMap->setColorScale(m_colorScale); m_colorMap->setColorScale(m_colorScale);
m_colorBarLayout->addElement(0,0, m_colorScale);
m_colorBarLayout->setMinimumSize(colorbar_width_logz,10);
m_colorBarLayout->setMargins(QMargins(0,0,0,0));
m_colorScale->axis()->axisRect()->setMargins(QMargins(0,0,0,0));
m_colorScale->axis()->axisRect()->setAutoMargins(QCP::msNone);
m_colorScale->setBarWidth(Constants::plot_colorbar_size); m_colorScale->setBarWidth(Constants::plot_colorbar_size);
m_colorScale->axis()->setTickLabelFont( m_colorScale->axis()->setTickLabelFont(
QFont(QFont().family(), Constants::plot_tick_label_size)); QFont(QFont().family(), Constants::plot_tick_label_size));
...@@ -433,12 +444,12 @@ void ColorMap::setDataRangeFromItem(IntensityDataItem* item) ...@@ -433,12 +444,12 @@ void ColorMap::setDataRangeFromItem(IntensityDataItem* item)
void ColorMap::setColorScaleVisible(bool visibility_flag) void ColorMap::setColorScaleVisible(bool visibility_flag)
{ {
m_colorScale->setVisible(visibility_flag); m_colorBarLayout->setVisible(visibility_flag);
if (visibility_flag) { if (visibility_flag) {
// add it to the right of the main axis rect // add it to the right of the main axis rect
m_customPlot->plotLayout()->addElement(0, 1, m_colorScale); m_customPlot->plotLayout()->addElement(0, 1, m_colorBarLayout);
} else { } else {
m_customPlot->plotLayout()->take(m_colorScale); m_customPlot->plotLayout()->take(m_colorBarLayout);
m_customPlot->plotLayout()->simplify(); m_customPlot->plotLayout()->simplify();
} }
} }
...@@ -448,12 +459,14 @@ void ColorMap::setColorScaleVisible(bool visibility_flag) ...@@ -448,12 +459,14 @@ void ColorMap::setColorScaleVisible(bool visibility_flag)
void ColorMap::marginsChangedNotify() void ColorMap::marginsChangedNotify()
{ {
QMargins axesMargins = m_customPlot->axisRect()->margins(); QMargins axesMargins = m_customPlot->axisRect()->margins();
QMargins colorBarMargins = m_colorScale->margins(); // QMargins colorBarMargins = m_colorScale->margins();
QMargins colorScaleMargins = m_colorScale->axis()->axisRect()->margins(); // QMargins colorScaleMargins = m_colorScale->axis()->axisRect()->margins();
double left = axesMargins.left(); double left = axesMargins.left();
double right = axesMargins.right() + colorBarMargins.right() + m_colorScale->barWidth() // double right = axesMargins.right() + colorBarMargins.right() + m_colorScale->barWidth()
+ colorScaleMargins.right(); // + colorScaleMargins.right() + m_colorBarLayout->rect().width();
double right = axesMargins.right() + m_colorBarLayout->rect().width();
emit marginsChanged(left, right); emit marginsChanged(left, right);
} }
......
...@@ -120,6 +120,7 @@ private: ...@@ -120,6 +120,7 @@ private:
QCPColorScale* m_colorScale; QCPColorScale* m_colorScale;
UpdateTimer* m_updateTimer; UpdateTimer* m_updateTimer;
ColorMapEvent* m_colorMapEvent; ColorMapEvent* m_colorMapEvent;
QCPLayoutGrid* m_colorBarLayout;
bool m_block_update; bool m_block_update;
}; };
......
...@@ -160,13 +160,6 @@ void ParameterTuningWidget::makeSelected(ParameterItem* item) ...@@ -160,13 +160,6 @@ void ParameterTuningWidget::makeSelected(ParameterItem* item)
selectionModel()->select(proxyIndex, QItemSelectionModel::Select); selectionModel()->select(proxyIndex, QItemSelectionModel::Select);
} }
void ParameterTuningWidget::resizeEvent(QResizeEvent* event)
{
Q_UNUSED(event);
if (m_treeView)
m_treeView->setColumnWidth(0, width()/2);
}
void ParameterTuningWidget::contextMenuEvent(QContextMenuEvent* ) void ParameterTuningWidget::contextMenuEvent(QContextMenuEvent* )
{ {
// reimplemented to suppress context menu from QMainWindow // reimplemented to suppress context menu from QMainWindow
......
...@@ -54,7 +54,6 @@ public slots: ...@@ -54,7 +54,6 @@ public slots:
void makeSelected(ParameterItem* item); void makeSelected(ParameterItem* item);
protected: protected:
void resizeEvent(QResizeEvent* event);
void contextMenuEvent(QContextMenuEvent*); void contextMenuEvent(QContextMenuEvent*);
void subscribeToItem(); void subscribeToItem();
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "mainwindow_constants.h" #include "mainwindow_constants.h"
#include "ExternalProperty.h" #include "ExternalProperty.h"
#include "MaterialItemUtils.h" #include "MaterialItemUtils.h"
#include "StyleUtils.h"
#include <QAction> #include <QAction>
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
...@@ -46,6 +47,8 @@ MaterialEditorDialog::MaterialEditorDialog(MaterialModel* materialModel, QWidget ...@@ -46,6 +47,8 @@ MaterialEditorDialog::MaterialEditorDialog(MaterialModel* materialModel, QWidget
layout->addLayout(createButtonLayout()); layout->addLayout(createButtonLayout());
setLayout(layout); setLayout(layout);
StyleUtils::setResizable(this);
} }
//! replaces original material model with the model modified by MaterialEditor //! replaces original material model with the model modified by MaterialEditor
......
...@@ -156,7 +156,7 @@ QWidget* createCustomDoubleEditor(const SessionItem& item) ...@@ -156,7 +156,7 @@ QWidget* createCustomDoubleEditor(const SessionItem& item)
result->setKeyboardTracking(true); result->setKeyboardTracking(true);
result->setFocusPolicy(Qt::StrongFocus); result->setFocusPolicy(Qt::StrongFocus);
result->installEventFilter(new WheelEventEater(result)); // result->installEventFilter(new WheelEventEater(result));
result->setMaximum(std::numeric_limits<double>::max()); result->setMaximum(std::numeric_limits<double>::max());
result->setMinimum(std::numeric_limits<double>::lowest()); result->setMinimum(std::numeric_limits<double>::lowest());
...@@ -178,7 +178,7 @@ QWidget* createCustomIntEditor(const SessionItem& item) ...@@ -178,7 +178,7 @@ QWidget* createCustomIntEditor(const SessionItem& item)
{ {
auto result = new QSpinBox; auto result = new QSpinBox;
result->setFocusPolicy(Qt::StrongFocus); result->setFocusPolicy(Qt::StrongFocus);
result->installEventFilter(new WheelEventEater(result)); // result->installEventFilter(new WheelEventEater(result));
result->setMaximum(std::numeric_limits<int>::max()); result->setMaximum(std::numeric_limits<int>::max());
result->setKeyboardTracking(true); result->setKeyboardTracking(true);
......
...@@ -22,6 +22,7 @@ SimulationView::SimulationView(MainWindow* mainWindow) ...@@ -22,6 +22,7 @@ SimulationView::SimulationView(MainWindow* mainWindow)
: QWidget(mainWindow), m_simulationSetupWidget(new SimulationSetupWidget), : QWidget(mainWindow), m_simulationSetupWidget(new SimulationSetupWidget),
m_toolBar(new StyledToolBar) m_toolBar(new StyledToolBar)
{ {
m_toolBar->setFixedHeight(m_toolBar->minimumHeight());
m_simulationSetupWidget->setApplicationModels(mainWindow->models()); m_simulationSetupWidget->setApplicationModels(mainWindow->models());
auto* mainLayout = new QVBoxLayout; auto* mainLayout = new QVBoxLayout;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "PythonSyntaxHighlighter.h" #include "PythonSyntaxHighlighter.h"
#include "WarningSign.h" #include "WarningSign.h"
#include "InstrumentItems.h" #include "InstrumentItems.h"
#include "StyleUtils.h"
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
...@@ -74,6 +75,7 @@ PythonScriptWidget::PythonScriptWidget(QWidget *parent) ...@@ -74,6 +75,7 @@ PythonScriptWidget::PythonScriptWidget(QWidget *parent)
setLayout(mainLayout); setLayout(mainLayout);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
StyleUtils::setResizable(this);
} }
void PythonScriptWidget::generatePythonScript(const MultiLayerItem *sampleItem, void PythonScriptWidget::generatePythonScript(const MultiLayerItem *sampleItem,
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "StyleUtils.h" #include "StyleUtils.h"
#include "DesignerHelper.h" #include "DesignerHelper.h"
#include "hostosinfo.h"
#include <QDialog>
#include <QTreeView> #include <QTreeView>
void StyleUtils::setPropertyStyle(QTreeView* tree) void StyleUtils::setPropertyStyle(QTreeView* tree)
...@@ -41,7 +43,7 @@ QString StyleUtils::propertyTreeStyle() ...@@ -41,7 +43,7 @@ QString StyleUtils::propertyTreeStyle()
"QTreeView::branch:open:has-children:!has-siblings," "QTreeView::branch:open:has-children:!has-siblings,"
"QTreeView::branch:open:has-children:has-siblings {" "QTreeView::branch:open:has-children:has-siblings {"
"padding:2px 2px 2px 2px;border-image: none; image: url(:/images/caret-down.svg);" "padding:2px 2px 2px 2px;border-image: none; image: url(:/images/caret-down.svg);"
"}"; "}";
// background of selected rows restored // background of selected rows restored
result += "QTreeView::item:selected{background:#3daee9;}"; result += "QTreeView::item:selected{background:#3daee9;}";
...@@ -51,19 +53,19 @@ QString StyleUtils::propertyTreeStyle() ...@@ -51,19 +53,19 @@ QString StyleUtils::propertyTreeStyle()
QString StyleUtils::realtimeTreeStyle() QString StyleUtils::realtimeTreeStyle()
{ {
QString result = QString result
"QTreeView::branch {background: " = "QTreeView::branch {background: "
"palette(base);}QTreeView::branch:has-siblings:!adjoins-item " "palette(base);}QTreeView::branch:has-siblings:!adjoins-item "
"{border-image: url(:/images/treeview-vline.png) 0;}QTreeView::branch:has-siblings:" "{border-image: url(:/images/treeview-vline.png) 0;}QTreeView::branch:has-siblings:"
"adjoins-item {border-image: url(:/images/treeview-branch-more.png) 0;}QTreeView::branch:" "adjoins-item {border-image: url(:/images/treeview-branch-more.png) 0;}QTreeView::branch:"
"!has-children:!has-siblings:adjoins-item {border-image: " "!has-children:!has-siblings:adjoins-item {border-image: "
"url(:/images/treeview-branch-end.png) " "url(:/images/treeview-branch-end.png) "
"0;}QTreeView::branch:has-children:!has-siblings:closed" "0;}QTreeView::branch:has-children:!has-siblings:closed"
",QTreeView::branch:closed:has-children:has-siblings {border-image: none;image: " ",QTreeView::branch:closed:has-children:has-siblings {border-image: none;image: "
"url(:/images/" "url(:/images/"
"treeview-branch-closed.png);}QTreeView::branch:open:has-children:!has-siblings," "treeview-branch-closed.png);}QTreeView::branch:open:has-children:!has-siblings,"
"QTreeView::branch:open:has-children:has-siblings {border-image: none;image: " "QTreeView::branch:open:has-children:has-siblings {border-image: none;image: "
"url(:/images/treeview-branch-open.png);}"; "url(:/images/treeview-branch-open.png);}";
return result; return result;
} }
...@@ -85,3 +87,12 @@ QFont StyleUtils::labelFont(bool bold) ...@@ -85,3 +87,12 @@ QFont StyleUtils::labelFont(bool bold)
return result; return result;
} }
void StyleUtils::setResizable(QDialog* dialog)
{
if (GUI_OS_Utils::HostOsInfo::isMacHost()) {
dialog->setWindowFlags(Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint
| Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
| Qt::Window);
}
}
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <QFont> #include <QFont>
class QTreeView; class QTreeView;
class QWidget;
namespace StyleUtils namespace StyleUtils
{ {
...@@ -39,6 +40,9 @@ BA_CORE_API_ QFont sectionFont(bool bold = false); ...@@ -39,6 +40,9 @@ BA_CORE_API_ QFont sectionFont(bool bold = false);
//! Returns font for labels. //! Returns font for labels.
BA_CORE_API_ QFont labelFont(bool bold = false); BA_CORE_API_ QFont labelFont(bool bold = false);
//! Make modal dialog resizable.
BA_CORE_API_ void setResizable(QDialog* dialog);
} }
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment