mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #335, style sheet fixes / improvements and support methods
style sheets: * style sheets with background textures * scroll area / toolbox style sheet fix * floating dock widgets * kept 1st version of stylesheets in backup directory * removed maininfoarea stylesheet, no longer needed with fixed style sheet code * central paintEvent method to enable style sheets in derived widgets * detect frameless windows, dynamic properties
This commit is contained in:
committed by
Roland Winklmeier
parent
65c2ed9db4
commit
c965fbb785
@@ -13,6 +13,8 @@
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -120,7 +122,7 @@ namespace BlackGui
|
||||
QString CStyleSheetUtility::style(const QString &fileName) const
|
||||
{
|
||||
if (!this->containsStyle(fileName)) return QString();
|
||||
return this->m_styleSheets[fileName.toLower()];
|
||||
return this->m_styleSheets[fileName.toLower()].trimmed();
|
||||
}
|
||||
|
||||
QString CStyleSheetUtility::styles(const QStringList &fileNames) const
|
||||
@@ -129,7 +131,7 @@ namespace BlackGui
|
||||
foreach(QString fileName, fileNames)
|
||||
{
|
||||
if (!this->containsStyle(fileName)) continue;
|
||||
QString s = this->m_styleSheets[fileName.toLower()];
|
||||
QString s = this->m_styleSheets[fileName.toLower()].trimmed();
|
||||
if (s.isEmpty()) continue;
|
||||
if (!style.isEmpty()) style.append("\n\n");
|
||||
style.append("/** file: ").append(fileName).append(" **/\n");
|
||||
@@ -219,4 +221,16 @@ namespace BlackGui
|
||||
dirPath.append("qss");
|
||||
return dirPath;
|
||||
}
|
||||
|
||||
void CStyleSheetUtility::useStyleSheetInDerivedWidget(QWidget *usedWidget)
|
||||
{
|
||||
Q_ASSERT(usedWidget);
|
||||
if (!usedWidget) { return; }
|
||||
Q_ASSERT(usedWidget->style());
|
||||
if (!usedWidget->style()) { return; }
|
||||
QStyleOption opt;
|
||||
opt.initFrom(usedWidget);
|
||||
QPainter p(usedWidget);
|
||||
usedWidget->style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, usedWidget);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user