Commit 59cb1772 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic '18250-pipeline-browser-filter-names-are-truncating'

17dd233b fix issues with restoring font.
78055252 ensure pqPipelineBrowserWidget uses updated font
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Cory Quammen's avatarCory Quammen <cory.quammen@kitware.com>
Merge-request: !2868
parents 3ad2ee33 17dd233b
Pipeline #122938 failed with stage
in 0 seconds
......@@ -72,6 +72,7 @@ void vtkPVInitializePythonModules();
#include <QMimeData>
#include <QTextCodec>
#include <QUrl>
#include <QtDebug>
#ifdef PARAVIEW_ENABLE_EMBEDDED_DOCUMENTATION
#include "ParaViewDocumentationInitializer.h"
......@@ -92,6 +93,7 @@ class ParaViewMainWindow::pqInternals : public Ui::pqClientMainWindow
public:
bool FirstShow;
int CurrentGUIFontSize;
QFont DefaultApplicationFont; // will be initialized to default app font in constructor.
pqTimer UpdateFontSizeTimer;
pqInternals()
: FirstShow(true)
......@@ -396,31 +398,33 @@ void ParaViewMainWindow::showWelcomeDialog()
//-----------------------------------------------------------------------------
void ParaViewMainWindow::updateFontSize()
{
auto& internals = *this->Internals;
vtkPVGeneralSettings* gsSettings = vtkPVGeneralSettings::GetInstance();
bool overrideFontSize = gsSettings->GetGUIOverrideFont();
int fontSize = overrideFontSize ? gsSettings->GetGUIFontSize() : 0;
if (this->Internals->CurrentGUIFontSize != fontSize)
int fontSize = internals.DefaultApplicationFont.pointSize();
if (gsSettings->GetGUIOverrideFont() && gsSettings->GetGUIFontSize() > 0)
{
if (fontSize > 0) // note vtkPVGeneralSettings clamps it to [8, INT_MAX)
{
this->setStyleSheet(QString("* { font-size: %1pt }").arg(fontSize));
}
else
{
this->setStyleSheet(QString());
}
fontSize = gsSettings->GetGUIFontSize();
}
if (fontSize <= 0)
{
qDebug() << "Ignoring invalid font size: " << fontSize;
return;
}
if (internals.CurrentGUIFontSize != fontSize)
{
this->setStyleSheet(QString("* { font-size: %1pt }").arg(fontSize));
this->Internals->CurrentGUIFontSize = fontSize;
}
// Console font size
int defaultFontSize = 12;
// Console font size
#if defined(PARAVIEW_ENABLE_PYTHON)
pqPythonShell* shell = qobject_cast<pqPythonShell*>(this->Internals->pythonShellDock->widget());
shell->setFontSize(fontSize == 0 ? defaultFontSize : fontSize);
shell->setFontSize(fontSize);
#endif
pqOutputWidget* outputWidget =
qobject_cast<pqOutputWidget*>(this->Internals->outputWidgetDock->widget());
outputWidget->setFontSize(fontSize == 0 ? defaultFontSize : fontSize);
outputWidget->setFontSize(fontSize);
}
//-----------------------------------------------------------------------------
......
......@@ -150,6 +150,20 @@ bool pqPipelineBrowserWidget::eventFilter(QObject* object, QEvent* eventArg)
return this->Superclass::eventFilter(object, eventArg);
}
//----------------------------------------------------------------------------
bool pqPipelineBrowserWidget::viewportEvent(QEvent* evt)
{
if (evt->type() == QEvent::FontChange)
{
// Pass the changed font to the model otherwise it doesn't use
// correct font for modified items.
QFont modifiedFont = this->font();
modifiedFont.setBold(true);
this->PipelineModel->setModifiedFont(modifiedFont);
}
return this->Superclass::viewportEvent(evt);
}
//----------------------------------------------------------------------------
void pqPipelineBrowserWidget::handleIndexClicked(const QModelIndex& index_)
{
......
......@@ -137,6 +137,11 @@ protected:
void contextMenuEvent(QContextMenuEvent* e) override;
/**
* Overridden to pass changed font to pqPipelineModel.
*/
bool viewportEvent(QEvent* e) override;
pqPipelineModel* PipelineModel;
pqPipelineAnnotationFilterModel* FilteredPipelineModel;
QPointer<QMenu> ContextMenu;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment