Fixed most depratated warnings.

This commit is contained in:
Jeremy Borgman
2020-07-10 20:56:30 -05:00
parent f5013df306
commit dc77029cde
14 changed files with 19 additions and 15 deletions

View File

@@ -66,7 +66,7 @@ public:
display_flags(FLAGS_DEFAULT),
color_from(&QColor::fromHsvF), rainbow_from_hue(&detail::rainbow_hsv)
{
QColor bgColor = widget->palette().background().color();
QColor bgColor = widget->palette().window().color();
bgBrightness = color_widgets::detail::color_lumaF(bgColor);
}

View File

@@ -107,7 +107,8 @@ void SingleApplicationPrivate::genBlockServerName( int timeout )
#endif
#ifdef Q_OS_UNIX
QProcess process;
process.start( QStringLiteral("whoami") );
process.start( QStringLiteral("whoami"),QStringList{} );
if( process.waitForFinished( timeout ) &&
process.exitCode() == QProcess::NormalExit) {
appData.addData( process.readLine() );

View File

@@ -52,7 +52,7 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) {
connect(m_configWatcher, &QFileSystemWatcher::fileChanged,
this, changedSlot);
QColor background = this->palette().background().color();
QColor background = this->palette().window().color();
bool isDark = ColorUtils::colorIsDark(background);
QString modifier = isDark ? PathInfo::whiteIconPath() :
PathInfo::blackIconPath();

View File

@@ -58,7 +58,7 @@ void FileNameEditor::initWidgets() {
// preview
m_outputLabel = new QLineEdit(this);
m_outputLabel->setDisabled(true);
QString foreground = this->palette().foreground().color().name();
QString foreground = this->palette().windowText().color().name();
m_outputLabel->setStyleSheet(QStringLiteral("color: %1").arg(foreground));
QPalette pal = m_outputLabel->palette();
QColor color = pal.color(QPalette::Disabled, m_outputLabel->backgroundRole());

View File

@@ -83,6 +83,7 @@ void Controller::requestCapture(const CaptureRequest &request) {
this->startFullscreenCapture(id);
});
break;
// TODO: Figure out the code path that gets here so the deprated warning can be fixed
case CaptureRequest::SCREEN_MODE: {
int &&number = request.data().toInt();
doLater(request.delay(), this, [this, id, number](){

View File

@@ -103,6 +103,8 @@ void AppLauncherWidget::launch(const QModelIndex &index) {
}
QString command = index.data(Qt::UserRole).toString().replace(
QRegExp("(\\%.)"), '"' + m_tempFile + '"');
QString app_name = index.data(Qt::UserRole).toString().split(" ").at(0);
bool inTerminal = index.data(Qt::UserRole+1).toBool() ||
m_terminalCheckbox->isChecked();
if (inTerminal) {
@@ -112,7 +114,7 @@ void AppLauncherWidget::launch(const QModelIndex &index) {
tr("Unable to launch in terminal."));
}
} else {
QProcess::startDetached(command);
QProcess::startDetached(app_name,{m_tempFile});
}
if (!m_keepOpen) {
close();

View File

@@ -56,5 +56,5 @@ TerminalApp TerminalLauncher::getPreferedTerminal() {
bool TerminalLauncher::launchDetached(const QString &command) {
TerminalApp app = getPreferedTerminal();
QString s = app.name + " " + app.arg + " " + command;
return QProcess::startDetached(s);
return QProcess::startDetached(app.name, {app.arg,command});
}

View File

@@ -58,7 +58,7 @@ int PinWidget::margin() const {
}
void PinWidget::wheelEvent(QWheelEvent *e) {
int val = e->delta() > 0 ? 15 : -15;
int val = e->angleDelta().y() > 0 ? 15 : -15;
int newWidth = qBound(50, m_label->width() + val, maximumWidth());
int newHeight = qBound(50, m_label->height() + val, maximumHeight());

View File

@@ -36,7 +36,7 @@ TextConfig::TextConfig(QWidget *parent) : QWidget(parent) {
int index = fontsCB->findText(font().family());
fontsCB->setCurrentIndex(index);
QColor bgColor(palette().background().color());
QColor bgColor(palette().windowText().color());
QString iconPrefix = ColorUtils::colorIsDark(bgColor) ?
PathInfo::whiteIconPath() :
PathInfo::blackIconPath();

View File

@@ -221,7 +221,7 @@ QVector<QPoint> ButtonHandler::verticalPoints(
QRect ButtonHandler::intersectWithAreas(const QRect &rect) {
QRect res;
for(const QRect &r : m_screenRegions.rects()) {
for(const QRect &r : m_screenRegions) {
QRect temp = rect.intersected(r);
if (temp.height() * temp.width() > res.height() * res.width()) {
res = temp;

View File

@@ -263,7 +263,7 @@ void CaptureWidget::paintEvent(QPaintEvent *) {
painter.setRenderHint(QPainter::Antialiasing);
painter.setBrush(m_uiColor);
for(auto r: m_selection->handlerAreas()) {
painter.drawRoundRect(r, 100, 100);
painter.drawRoundedRect(r, 100, 100);
}
}
}
@@ -510,7 +510,7 @@ void CaptureWidget::keyReleaseEvent(QKeyEvent *e) {
}
void CaptureWidget::wheelEvent(QWheelEvent *e) {
m_context.thickness += e->delta() / 120;
m_context.thickness += e->angleDelta().y() / 120;
m_context.thickness = qBound(0, m_context.thickness, 100);
QPoint topLeft = qApp->desktop()->screenGeometry(
qApp->desktop()->screenNumber(QCursor::pos())).topLeft();

View File

@@ -82,11 +82,11 @@ void ColorPicker::paintEvent(QPaintEvent *) {
highlight.moveTo(highlight.x() - 3, highlight.y() - 3);
highlight.setHeight(highlight.height() + 6);
highlight.setWidth(highlight.width() + 6);
painter.drawRoundRect(highlight, 100, 100);
painter.drawRoundedRect(highlight, 100, 100);
painter.setPen(QColor(Qt::black));
}
painter.setBrush(QColor(m_colorList.at(i)));
painter.drawRoundRect(rects.at(i), 100, 100);
painter.drawRoundedRect(rects.at(i), 100, 100);
}
}

View File

@@ -73,7 +73,7 @@ SidePanelWidget::SidePanelWidget(QPixmap *p, QWidget *parent) :
connect(this, &SidePanelWidget::thicknessChanged,
this, &SidePanelWidget::updateThickness);
QColor background = this->palette().background().color();
QColor background = this->palette().window().color();
bool isDark = ColorUtils::colorIsDark(background);
QString modifier = isDark ? PathInfo::whiteIconPath() :
PathInfo::blackIconPath();

View File

@@ -90,7 +90,7 @@ void UtilityPanel::initInternalPanel() {
m_layout->addLayout(m_upLayout);
widget->setLayout(m_layout);
QColor bgColor = palette().background().color();
QColor bgColor = palette().window().color();
bgColor.setAlphaF(0.0);
m_internalPanel->setStyleSheet(QStringLiteral("QScrollArea {background-color: %1}")
.arg(bgColor.name()));