mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-19 14:55:54 -04:00
added fontSizeHandler for Identity list
This commit is contained in:
parent
39b062fecf
commit
1720a94a80
@ -450,7 +450,13 @@ IdDialog::IdDialog(QWidget *parent)
|
||||
updateIdTimer.setSingleShot(true);
|
||||
connect(&updateIdTimer, SIGNAL(timeout()), this, SLOT(updateIdList()));
|
||||
|
||||
mFontSizeHandler.registerFontSize(ui->treeWidget_membership, 0, [this] (QAbstractItemView*, int fontSize) {
|
||||
mFontSizeHandler.registerFontSize(ui->idTreeWidget, 0, [this] (QAbstractItemView*, int fontSize) {
|
||||
// Set new font size on all items
|
||||
|
||||
mIdListModel->setFontSize(fontSize);
|
||||
});
|
||||
|
||||
mFontSizeHandler.registerFontSize(ui->treeWidget_membership, 0, [this] (QAbstractItemView*, int fontSize) {
|
||||
// Set new font size on all items
|
||||
QTreeWidgetItemIterator it(ui->treeWidget_membership);
|
||||
while (*it) {
|
||||
|
@ -53,6 +53,8 @@ RsIdentityListModel::RsIdentityListModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
, mLastInternalDataUpdate(0), mLastNodeUpdate(0)
|
||||
{
|
||||
mFontSize = QApplication::font().pointSize();
|
||||
|
||||
mFilterStrings.clear();
|
||||
mIdentityUpdateTimer = new QTimer();
|
||||
connect(mIdentityUpdateTimer,SIGNAL(timeout()),this,SLOT(timerUpdate()));
|
||||
@ -565,19 +567,28 @@ QVariant RsIdentityListModel::foregroundRole(const EntryIndex& e, int /*col*/) c
|
||||
}
|
||||
QVariant RsIdentityListModel::fontRole(const EntryIndex& e, int /*col*/) const
|
||||
{
|
||||
auto it = getIdentityInfo(e);
|
||||
if(!it)
|
||||
return QVariant();
|
||||
RsGxsId id(it->id);
|
||||
QFont f;
|
||||
f.setPointSize(mFontSize);
|
||||
|
||||
if(rsIdentity->isOwnId(id))
|
||||
auto it = getIdentityInfo(e);
|
||||
|
||||
if(it)
|
||||
{
|
||||
QFont f;
|
||||
f.setBold(true);
|
||||
return QVariant(f);
|
||||
RsGxsId id(it->id);
|
||||
|
||||
if(rsIdentity->isOwnId(id))
|
||||
f.setBold(true);
|
||||
}
|
||||
|
||||
return QVariant(f);
|
||||
}
|
||||
void RsIdentityListModel::setFontSize(int s)
|
||||
{
|
||||
if(s != mFontSize)
|
||||
{
|
||||
mFontSize = s;
|
||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
|
||||
}
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
#ifdef DEBUG_MODEL_INDEX
|
||||
|
@ -143,6 +143,7 @@ public:
|
||||
EntryType getType(const QModelIndex&) const;
|
||||
RsGxsId getIdentity(const QModelIndex&) const;
|
||||
int getCategory(const QModelIndex&) const;
|
||||
void setFontSize(int s);
|
||||
|
||||
void setFilter(uint8_t filter_type, const QStringList& strings) ;
|
||||
|
||||
@ -221,6 +222,7 @@ private:
|
||||
|
||||
QStringList mFilterStrings;
|
||||
uint8_t mFilterType;
|
||||
int mFontSize;
|
||||
|
||||
rstime_t mLastInternalDataUpdate;
|
||||
rstime_t mLastNodeUpdate;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user