Browse Source

Suppress remove null widget warning

And improve text format for translation work.
adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
8a7179195f
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 26
      src/gui/properties/propertieswidget.cpp

26
src/gui/properties/propertieswidget.cpp

@ -752,21 +752,31 @@ void PropertiesWidget::configure() @@ -752,21 +752,31 @@ void PropertiesWidget::configure()
// Speed widget
if (Preferences::instance()->isSpeedWidgetEnabled())
{
if (!m_speedWidget || !qobject_cast<SpeedWidget *>(m_speedWidget))
if (!qobject_cast<SpeedWidget *>(m_speedWidget))
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
m_speedWidget = new SpeedWidget {this};
if (m_speedWidget)
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
}
m_speedWidget = new SpeedWidget(this);
m_ui->speedLayout->addWidget(m_speedWidget);
}
}
else
{
if (!m_speedWidget || !qobject_cast<QLabel *>(m_speedWidget))
if (!qobject_cast<QLabel *>(m_speedWidget))
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
auto *label = new QLabel(tr("<center><b>Speed graphs are disabled</b><p>You may change this setting in Advanced Options </center>"), this);
if (m_speedWidget)
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
}
const auto displayText = QString::fromLatin1("<center><b>%1</b><p>%2</p></center>")
.arg(tr("Speed graphs are disabled"), tr("You can enable it in Advanced Options"));
auto *label = new QLabel(displayText, this);
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
m_speedWidget = label;
m_ui->speedLayout->addWidget(m_speedWidget);

Loading…
Cancel
Save