Remove deprecated Qt constants

Qt has deprecated the following constants, this commit replaces them
with their new equivalent/replacement:

Qt::TextColorRole -> Qt::ForegroundRole
Qt::BackgroundColorRole -> Qt::BackgroundRole
QPainter::HighQualityAntialiasing -> QPainter::Antialiasing
QPalette::Foreground -> QPalette::WindowText
This commit is contained in:
Chris Hennes
2021-03-10 10:52:54 -06:00
committed by wmayer
parent 1f62d46661
commit b15f134038
6 changed files with 17 additions and 17 deletions

View File

@@ -3133,11 +3133,11 @@ void DocumentItem::slotResetEdit(const Gui::ViewProviderDocumentObject& v)
FOREACH_ITEM_ALL(item)
if(tree->editingItem) {
if(item == tree->editingItem) {
item->setData(0, Qt::BackgroundColorRole,QVariant());
item->setData(0, Qt::BackgroundRole,QVariant());
break;
}
}else if(item->object() == &v)
item->setData(0, Qt::BackgroundColorRole,QVariant());
item->setData(0, Qt::BackgroundRole,QVariant());
END_FOREACH_ITEM
tree->editingItem = 0;
}
@@ -4592,7 +4592,7 @@ void DocumentObjectItem::testStatus(bool resetStatus, QIcon &icon1, QIcon &icon2
#if QT_VERSION >= 0x040200
this->setData(0, Qt::ForegroundRole,QVariant());
#else
this->setData(0, Qt::TextColorRole,QVariant());
this->setData(0, Qt::ForegroundRole,QVariant());
#endif
}
else { // invisible

View File

@@ -530,7 +530,7 @@ void View3DInventor::printPreview()
void View3DInventor::print(QPrinter* printer)
{
QPainter p(printer);
p.setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing);
p.setRenderHints(QPainter::Antialiasing);
if (!p.isActive() && !printer->outputFileName().isEmpty()) {
qApp->setOverrideCursor(Qt::ArrowCursor);
QMessageBox::critical(this, tr("Opening file failed"),

View File

@@ -537,7 +537,7 @@ QVariant PropertyItem::data(int column, int role) const
{
// property name
if (column == 0) {
if (role == Qt::BackgroundRole || role == Qt::TextColorRole) {
if (role == Qt::BackgroundRole || role == Qt::ForegroundRole) {
if(PropertyView::showAll()
&& propertyItems.size() == 1
&& propertyItems.front()->testStatus(App::Property::PropDynamic)
@@ -587,7 +587,7 @@ QVariant PropertyItem::data(int column, int role) const
QVariant val = parent->property(qPrintable(objectName()));
return toString(val);
}
else if (role == Qt::TextColorRole) {
else if (role == Qt::ForegroundRole) {
if (hasExpression())
return QVariant::fromValue(QApplication::palette().color(QPalette::Link));
return QVariant();
@@ -607,7 +607,7 @@ QVariant PropertyItem::data(int column, int role) const
else if (role == Qt::ToolTipRole) {
return toolTip(propertyItems[0]);
}
else if( role == Qt::TextColorRole) {
else if( role == Qt::ForegroundRole) {
if (hasExpression())
return QVariant::fromValue(QApplication::palette().color(QPalette::Link));
return QVariant();
@@ -3908,11 +3908,11 @@ QVariant PropertyLinkItem::toString(const QVariant& prop) const
QVariant PropertyLinkItem::data(int column, int role) const {
if(propertyItems.size() && column == 1
&& (role == Qt::TextColorRole || role == Qt::ToolTipRole))
&& (role == Qt::ForegroundRole || role == Qt::ToolTipRole))
{
auto propLink = Base::freecad_dynamic_cast<const App::PropertyLinkBase>(propertyItems[0]);
if(propLink) {
if(role==Qt::TextColorRole && propLink->checkRestore()>1)
if(role==Qt::ForegroundRole && propLink->checkRestore()>1)
return QVariant::fromValue(QColor(0xff,0,0));
else if(role == Qt::ToolTipRole) {
auto xlink = Base::freecad_dynamic_cast<const App::PropertyXLink>(propertyItems[0]);

View File

@@ -154,7 +154,7 @@ void SvgView::setRenderer(RendererType type)
void SvgView::setHighQualityAntialiasing(bool highQualityAntialiasing)
{
#ifndef QT_NO_OPENGL
setRenderHint(QPainter::HighQualityAntialiasing, highQualityAntialiasing);
setRenderHint(QPainter::Antialiasing);
#else
Q_UNUSED(highQualityAntialiasing);
#endif

View File

@@ -209,7 +209,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
return QVariant::fromValue(QString::fromUtf8("#ERR"));
#endif
}
case Qt::TextColorRole:
case Qt::ForegroundRole:
return QVariant::fromValue(QColor(255.0, 0, 0));
case Qt::TextAlignmentRole:
return QVariant(Qt::AlignVCenter | Qt::AlignLeft);
@@ -283,7 +283,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
if (!prop) {
switch (role) {
case Qt::TextColorRole: {
case Qt::ForegroundRole: {
return QColor(0, 0, 255.0);
}
case Qt::TextAlignmentRole: {
@@ -303,7 +303,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
const App::PropertyString * stringProp = static_cast<const App::PropertyString*>(prop);
switch (role) {
case Qt::TextColorRole: {
case Qt::ForegroundRole: {
Color color;
if (cell->getForeground(color))
@@ -333,7 +333,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
const App::PropertyQuantity * floatProp = static_cast<const App::PropertyQuantity*>(prop);
switch (role) {
case Qt::TextColorRole: {
case Qt::ForegroundRole: {
Color color;
if (cell->getForeground(color))
@@ -402,7 +402,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
d = static_cast<const App::PropertyInteger*>(prop)->getValue();
switch (role) {
case Qt::TextColorRole: {
case Qt::ForegroundRole: {
Color color;
if (cell->getForeground(color))
@@ -449,7 +449,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
auto pyProp = static_cast<const App::PropertyPythonObject*>(prop);
switch (role) {
case Qt::TextColorRole: {
case Qt::ForegroundRole: {
Color color;
if (cell->getForeground(color))

View File

@@ -81,7 +81,7 @@ void Workbench::activated()
foregroundColor = new QtColorPicker();
foregroundColor->setObjectName(QString::fromLatin1("Spreadsheet_ForegroundColor"));
foregroundColor->setStandardColors();
foregroundColor->setCurrentColor(palette.color(QPalette::Foreground));
foregroundColor->setCurrentColor(palette.color(QPalette::WindowText));
QObject::connect(foregroundColor, SIGNAL(colorSet(QColor)), workbenchHelper.get(), SLOT(setForegroundColor(QColor)));
}
foregroundColor->setToolTip(QObject::tr("Set cell(s) foreground color"));