mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 17:13:58 -05:00
Replaced deprecated Qt::BackgroundColorRole by Qt::BackgroundRole and Qt::TextColorRole by Qt::ForegroundRole
This commit is contained in:
parent
ff822498a6
commit
c4c2c5a0d1
11 changed files with 12 additions and 12 deletions
|
|
@ -61,7 +61,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||||
painter->setClipRect(opt.rect);
|
painter->setClipRect(opt.rect);
|
||||||
|
|
||||||
//set text color
|
//set text color
|
||||||
QVariant value = index.data(Qt::TextColorRole);
|
QVariant value = index.data(Qt::ForegroundRole);
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ public:
|
||||||
{
|
{
|
||||||
case Qt::SizeHintRole: return sizeHintRole(index.column()) ;
|
case Qt::SizeHintRole: return sizeHintRole(index.column()) ;
|
||||||
case Qt::TextAlignmentRole:
|
case Qt::TextAlignmentRole:
|
||||||
case Qt::TextColorRole:
|
case Qt::ForegroundRole:
|
||||||
case Qt::WhatsThisRole:
|
case Qt::WhatsThisRole:
|
||||||
case Qt::EditRole:
|
case Qt::EditRole:
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||||
painter->setClipRect(opt.rect);
|
painter->setClipRect(opt.rect);
|
||||||
|
|
||||||
//set text color
|
//set text color
|
||||||
QVariant value = index.data(Qt::TextColorRole);
|
QVariant value = index.data(Qt::ForegroundRole);
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class RSHumanReadableDelegate: public QAbstractItemDelegate
|
||||||
// This part of the code is copied from DLListDelegate.cpp
|
// This part of the code is copied from DLListDelegate.cpp
|
||||||
//
|
//
|
||||||
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||||
QVariant value = index.data(Qt::TextColorRole);
|
QVariant value = index.data(Qt::ForegroundRole);
|
||||||
|
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid())
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid())
|
||||||
option.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
option.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||||
|
|
@ -75,7 +75,7 @@ class RSHumanReadableDelegate: public QAbstractItemDelegate
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = index.data(Qt::BackgroundColorRole);
|
value = index.data(Qt::BackgroundRole);
|
||||||
|
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid())
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid())
|
||||||
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
|
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
|
||||||
|
|
|
||||||
|
|
@ -825,7 +825,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
||||||
if (role == RetroshareDirModel::FileNameRole) /* end of FileNameRole */
|
if (role == RetroshareDirModel::FileNameRole) /* end of FileNameRole */
|
||||||
return QString::fromUtf8(details.name.c_str()) ;
|
return QString::fromUtf8(details.name.c_str()) ;
|
||||||
|
|
||||||
if (role == Qt::TextColorRole)
|
if (role == Qt::ForegroundRole)
|
||||||
{
|
{
|
||||||
if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull())
|
if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull())
|
||||||
return QVariant(QColor(Qt::green)) ;
|
return QVariant(QColor(Qt::green)) ;
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ QVariant RsFriendListModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::SizeHintRole: return sizeHintRole(entry,index.column()) ;
|
case Qt::SizeHintRole: return sizeHintRole(entry,index.column()) ;
|
||||||
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
|
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
|
||||||
case Qt::FontRole: return fontRole(entry,index.column()) ;
|
case Qt::FontRole: return fontRole(entry,index.column()) ;
|
||||||
case Qt::TextColorRole: return textColorRole(entry,index.column()) ;
|
case Qt::ForegroundRole: return textColorRole(entry,index.column()) ;
|
||||||
case Qt::DecorationRole: return decorationRole(entry,index.column()) ;
|
case Qt::DecorationRole: return decorationRole(entry,index.column()) ;
|
||||||
|
|
||||||
case FilterRole: return filterRole(entry,index.column()) ;
|
case FilterRole: return filterRole(entry,index.column()) ;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void GroupSelectionBox::fillGroups()
|
||||||
for (std::list<RsGroupInfo>::const_iterator it(groupIds.begin()); it != groupIds.end(); ++it) {
|
for (std::list<RsGroupInfo>::const_iterator it(groupIds.begin()); it != groupIds.end(); ++it) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(GroupDefs::name(*it));
|
QListWidgetItem *item = new QListWidgetItem(GroupDefs::name(*it));
|
||||||
item->setData(ROLE_ID, QString::fromStdString(it->id.toStdString()));
|
item->setData(ROLE_ID, QString::fromStdString(it->id.toStdString()));
|
||||||
item->setBackgroundColor(QColor(183,236,181));
|
item->setBackground(QColor(183,236,181));
|
||||||
addItem(item);
|
addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ QVariant RsCollectionModel::data(const QModelIndex& index, int role) const
|
||||||
case Qt::DisplayRole: return displayRole(i,index.column());
|
case Qt::DisplayRole: return displayRole(i,index.column());
|
||||||
case Qt::DecorationRole: return decorationRole(i,index.column());
|
case Qt::DecorationRole: return decorationRole(i,index.column());
|
||||||
case Qt::CheckStateRole: return checkStateRole(i,index.column());
|
case Qt::CheckStateRole: return checkStateRole(i,index.column());
|
||||||
case Qt::TextColorRole: return textColorRole(i,index.column());
|
case Qt::ForegroundRole: return textColorRole(i,index.column());
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ QVariant RsGxsForumModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
||||||
case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
||||||
case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
||||||
case Qt::TextColorRole: return textColorRole (fmpe,index.column()) ;
|
case Qt::ForegroundRole: return textColorRole (fmpe,index.column()) ;
|
||||||
case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
||||||
|
|
||||||
case FilterRole: return filterRole (fmpe,index.column()) ;
|
case FilterRole: return filterRole (fmpe,index.column()) ;
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
||||||
case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
||||||
case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
||||||
case Qt::TextColorRole: return textColorRole (fmpe,index.column()) ;
|
case Qt::ForegroundRole: return textColorRole (fmpe,index.column()) ;
|
||||||
case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
||||||
|
|
||||||
case FilterRole: return filterRole (fmpe,index.column()) ;
|
case FilterRole: return filterRole (fmpe,index.column()) ;
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ void BWListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||||
painter->setClipRect(opt.rect);
|
painter->setClipRect(opt.rect);
|
||||||
|
|
||||||
//set text color
|
//set text color
|
||||||
QVariant value = index.data(Qt::TextColorRole);
|
QVariant value = index.data(Qt::ForegroundRole);
|
||||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue