mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-23 05:44:45 -04:00
added fontSizeHandler for Identity list
This commit is contained in:
parent
39b062fecf
commit
1720a94a80
3 changed files with 30 additions and 11 deletions
|
@ -450,6 +450,12 @@ IdDialog::IdDialog(QWidget *parent)
|
||||||
updateIdTimer.setSingleShot(true);
|
updateIdTimer.setSingleShot(true);
|
||||||
connect(&updateIdTimer, SIGNAL(timeout()), this, SLOT(updateIdList()));
|
connect(&updateIdTimer, SIGNAL(timeout()), this, SLOT(updateIdList()));
|
||||||
|
|
||||||
|
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) {
|
mFontSizeHandler.registerFontSize(ui->treeWidget_membership, 0, [this] (QAbstractItemView*, int fontSize) {
|
||||||
// Set new font size on all items
|
// Set new font size on all items
|
||||||
QTreeWidgetItemIterator it(ui->treeWidget_membership);
|
QTreeWidgetItemIterator it(ui->treeWidget_membership);
|
||||||
|
|
|
@ -53,6 +53,8 @@ RsIdentityListModel::RsIdentityListModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
, mLastInternalDataUpdate(0), mLastNodeUpdate(0)
|
, mLastInternalDataUpdate(0), mLastNodeUpdate(0)
|
||||||
{
|
{
|
||||||
|
mFontSize = QApplication::font().pointSize();
|
||||||
|
|
||||||
mFilterStrings.clear();
|
mFilterStrings.clear();
|
||||||
mIdentityUpdateTimer = new QTimer();
|
mIdentityUpdateTimer = new QTimer();
|
||||||
connect(mIdentityUpdateTimer,SIGNAL(timeout()),this,SLOT(timerUpdate()));
|
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
|
QVariant RsIdentityListModel::fontRole(const EntryIndex& e, int /*col*/) const
|
||||||
{
|
{
|
||||||
|
QFont f;
|
||||||
|
f.setPointSize(mFontSize);
|
||||||
|
|
||||||
auto it = getIdentityInfo(e);
|
auto it = getIdentityInfo(e);
|
||||||
if(!it)
|
|
||||||
return QVariant();
|
if(it)
|
||||||
|
{
|
||||||
RsGxsId id(it->id);
|
RsGxsId id(it->id);
|
||||||
|
|
||||||
if(rsIdentity->isOwnId(id))
|
if(rsIdentity->isOwnId(id))
|
||||||
{
|
|
||||||
QFont f;
|
|
||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
|
}
|
||||||
|
|
||||||
return QVariant(f);
|
return QVariant(f);
|
||||||
}
|
}
|
||||||
else
|
void RsIdentityListModel::setFontSize(int s)
|
||||||
return QVariant();
|
{
|
||||||
|
if(s != mFontSize)
|
||||||
|
{
|
||||||
|
mFontSize = s;
|
||||||
|
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MODEL_INDEX
|
#ifdef DEBUG_MODEL_INDEX
|
||||||
|
|
|
@ -143,6 +143,7 @@ public:
|
||||||
EntryType getType(const QModelIndex&) const;
|
EntryType getType(const QModelIndex&) const;
|
||||||
RsGxsId getIdentity(const QModelIndex&) const;
|
RsGxsId getIdentity(const QModelIndex&) const;
|
||||||
int getCategory(const QModelIndex&) const;
|
int getCategory(const QModelIndex&) const;
|
||||||
|
void setFontSize(int s);
|
||||||
|
|
||||||
void setFilter(uint8_t filter_type, const QStringList& strings) ;
|
void setFilter(uint8_t filter_type, const QStringList& strings) ;
|
||||||
|
|
||||||
|
@ -221,6 +222,7 @@ private:
|
||||||
|
|
||||||
QStringList mFilterStrings;
|
QStringList mFilterStrings;
|
||||||
uint8_t mFilterType;
|
uint8_t mFilterType;
|
||||||
|
int mFontSize;
|
||||||
|
|
||||||
rstime_t mLastInternalDataUpdate;
|
rstime_t mLastInternalDataUpdate;
|
||||||
rstime_t mLastNodeUpdate;;
|
rstime_t mLastNodeUpdate;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue