mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 04:14:27 -04:00
Added changes from braindead:
- simplified avatarwidget - prepared property-dependend stylesheets git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5176 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ce22ab5be9
commit
b344aebbe6
6 changed files with 107 additions and 148 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <QTextStream>
|
||||
#include <QShortcut>
|
||||
#include <QStyleFactory>
|
||||
#include <QStyle>
|
||||
#include <gui/common/vmessagebox.h>
|
||||
#include <gui/common/html.h>
|
||||
#include <util/stringutil.h>
|
||||
|
@ -374,6 +375,31 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
|||
qApp->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void Rshare::refreshStyleSheet(QWidget *widget, bool processChildren)
|
||||
{
|
||||
if (widget != NULL) {
|
||||
// force widget to recalculate valid style
|
||||
widget->style()->unpolish(widget);
|
||||
widget->style()->polish(widget);
|
||||
// widget might need to recalculate properties (like margins) depending on style
|
||||
QEvent event(QEvent::StyleChange);
|
||||
QApplication::sendEvent(widget, &event);
|
||||
// repaint widget
|
||||
widget->update();
|
||||
|
||||
if (processChildren == true) {
|
||||
// process children recursively
|
||||
QObjectList childList = widget->children ();
|
||||
for (QObjectList::Iterator it = childList.begin(); it != childList.end(); it++) {
|
||||
QWidget *child = qobject_cast<QWidget*>(*it);
|
||||
if (child != NULL) {
|
||||
refreshStyleSheet(child, processChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Initialize plugins. */
|
||||
void Rshare::initPlugins()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue