Don't use functions obsoleted in Qt 5.13.0

This commit is contained in:
Martchus 2019-06-25 13:49:53 +02:00
parent ffb0e2e076
commit 6ac633366e
9 changed files with 30 additions and 15 deletions

View File

@ -10,7 +10,7 @@ SyncthingInfoWidget::SyncthingInfoWidget(const SyncthingInfoAction *action, QWid
, m_iconLabel(new QLabel(parent))
{
auto *const layout = new QHBoxLayout(parent);
layout->setMargin(4);
layout->setContentsMargins(4, 4, 4, 4);
layout->setSpacing(5);
m_iconLabel->setFixedWidth(16);
m_iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);

View File

@ -244,7 +244,7 @@ void SyncthingApplet::updateStatusIconAndTooltip()
QIcon SyncthingApplet::loadFontAwesomeIcon(const QString &name, bool solid) const
{
return Data::renderSvgImage(Data::loadFontAwesomeIcon(name, QGuiApplication::palette().color(QPalette::Foreground), solid), QSize(32, 32), 8);
return Data::renderSvgImage(Data::loadFontAwesomeIcon(name, QGuiApplication::palette().color(QPalette::WindowText), solid), QSize(32, 32), 8);
}
QString SyncthingApplet::formatFileSize(quint64 fileSizeInByte) const

View File

@ -68,7 +68,7 @@ void DownloadItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
progressBarOption.textAlignment = Qt::AlignCenter;
progressBarOption.textVisible = true;
if (option.state & QStyle::State_Selected) {
progressBarOption.palette.setBrush(QPalette::Foreground, option.palette.brush(QPalette::HighlightedText));
progressBarOption.palette.setBrush(QPalette::WindowText, option.palette.brush(QPalette::HighlightedText));
}
progressBarOption.progress = model->data(index, SyncthingDownloadModel::ItemPercentage).toInt();
progressBarOption.minimum = 0;

View File

@ -20,7 +20,7 @@ TrayMenu::TrayMenu(TrayIcon *trayIcon, QWidget *parent)
, m_trayIcon(trayIcon)
{
auto *const menuLayout = new QHBoxLayout;
menuLayout->setMargin(0);
menuLayout->setContentsMargins(0, 0, 0, 0);
menuLayout->setSpacing(0);
menuLayout->addWidget(m_trayWidget = new TrayWidget(this));
setLayout(menuLayout);

View File

@ -87,8 +87,7 @@ TrayWidget::TrayWidget(TrayMenu *parent)
m_cornerFrame = new QFrame(this);
auto *cornerFrameLayout = new QHBoxLayout(m_cornerFrame);
cornerFrameLayout->setSpacing(0);
cornerFrameLayout->setMargin(0);
//cornerFrameLayout->addStretch();
cornerFrameLayout->setContentsMargins(0, 0, 0, 0);
m_cornerFrame->setLayout(cornerFrameLayout);
auto *viewIdButton = new QPushButton(m_cornerFrame);
viewIdButton->setToolTip(tr("View own device ID"));
@ -506,8 +505,8 @@ void TrayWidget::updateTraffic()
static const auto trafficIcons = [this]() {
const auto size = QSize(16, 13);
const auto &palette = m_ui->trafficFormWidget->palette(); // FIXME: make this aware of palette changes
const auto colorBackground = palette.color(QPalette::Background);
const auto colorActive = palette.color(QPalette::Foreground);
const auto colorBackground = palette.color(QPalette::Window);
const auto colorActive = palette.color(QPalette::WindowText);
const auto colorInactive = QColor((colorActive.red() + colorBackground.red()) / 2, (colorActive.green() + colorBackground.green()) / 2,
(colorActive.blue() + colorBackground.blue()) / 2);
const auto renderIcon

View File

@ -31,7 +31,7 @@ DirectoryErrorsDialog::DirectoryErrorsDialog(const Data::SyncthingConnection &co
{
// add layout to show status and additional buttons
auto *const buttonLayout = new QHBoxLayout;
buttonLayout->setMargin(0);
buttonLayout->setContentsMargins(0, 0, 0, 0);
layout()->addLayout(buttonLayout);
// add label for overall status
@ -45,7 +45,7 @@ DirectoryErrorsDialog::DirectoryErrorsDialog(const Data::SyncthingConnection &co
m_rmNonEmptyDirsButton = new QPushButton(this);
m_rmNonEmptyDirsButton->setText(tr("Remove non-empty directories"));
m_rmNonEmptyDirsButton->setIcon(QIcon::fromTheme(QStringLiteral("remove")));
buttonLayout->setMargin(0);
buttonLayout->setContentsMargins(0, 0, 0, 0);
buttonLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
buttonLayout->addWidget(m_rmNonEmptyDirsButton);

View File

@ -33,7 +33,7 @@ InternalErrorsDialog::InternalErrorsDialog()
// add layout to show status and additional buttons
auto *const buttonLayout = new QHBoxLayout;
buttonLayout->setMargin(0);
buttonLayout->setContentsMargins(0, 0, 0, 0);
// add label for overall status
QFont boldFont(m_statusLabel->font());
@ -52,7 +52,7 @@ InternalErrorsDialog::InternalErrorsDialog()
auto *const clearButton = new QPushButton(this);
clearButton->setText(tr("Clear errors"));
clearButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear")));
buttonLayout->setMargin(0);
buttonLayout->setContentsMargins(0, 0, 0, 0);
buttonLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
buttonLayout->addWidget(clearButton);
connect(clearButton, &QPushButton::clicked, &InternalErrorsDialog::clearErrors);

View File

@ -27,7 +27,7 @@ QDialog *ownDeviceIdDialog(Data::SyncthingConnection &connection)
dlg->setWindowTitle(QCoreApplication::translate("QtGui::OtherDialogs", "Own device ID") + QStringLiteral(" - " APP_NAME));
dlg->setWindowIcon(QIcon(QStringLiteral(":/icons/hicolor/scalable/app/syncthingtray.svg")));
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setBackgroundRole(QPalette::Background);
dlg->setBackgroundRole(QPalette::Window);
auto *layout = new QVBoxLayout(dlg);
layout->setAlignment(Qt::AlignCenter);
auto *pixmapLabel = new QLabel(dlg);

View File

@ -29,7 +29,15 @@ void SyncthingKiller::waitForFinished()
continue;
}
if (!waitForSignalsOrFail(noop, 0, signalInfo(this, &SyncthingKiller::ignored),
signalInfo(process, static_cast<void (SyncthingProcess::*)(int)>(&SyncthingProcess::finished)))) {
signalInfo(process,
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) || QT_DEPRECATED_SINCE(5, 13)
static_cast<void (SyncthingProcess::*)(int)>(
#endif
&SyncthingProcess::finished
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) || QT_DEPRECATED_SINCE(5, 13)
)
#endif
))) {
return;
}
}
@ -50,7 +58,15 @@ void SyncthingKiller::confirmKill() const
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->addButton(tr("Keep running"), QMessageBox::RejectRole);
msgBox->addButton(tr("Kill process"), QMessageBox::AcceptRole);
connect(process, static_cast<void (QProcess::*)(int)>(&SyncthingProcess::finished), msgBox, &QMessageBox::close);
connect(process,
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) || QT_DEPRECATED_SINCE(5, 13)
static_cast<void (QProcess::*)(int)>(
#endif
&SyncthingProcess::finished
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) || QT_DEPRECATED_SINCE(5, 13)
)
#endif
, msgBox, &QMessageBox::close);
connect(msgBox, &QMessageBox::accepted, process, &SyncthingProcess::killSyncthing);
// FIXME: can not really ignore, just keep the process running
//connect(msgBox, &QMessageBox::rejected, this, &SyncthingKiller::ignored);