Use prefix for resources.

Updates demo project and README with clean main() and initStyleSheet().
This commit is contained in:
mfreiholz 2016-04-18 12:47:42 +02:00
parent 8c3a00d7b5
commit 94b1fc85fc
3 changed files with 28 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/">
<qresource prefix="/ads">
<file>stylesheets/default-windows.css</file>
<file>stylesheets/vendor-partsolutions.css</file>
<file>stylesheets/modern-windows.css</file>

View File

@ -6,12 +6,11 @@
static void initStyleSheet(QApplication& a)
{
QFile f(":/stylesheets/default-windows.css");
// QFile f(":/stylesheets/modern-windows.css");
// QFile f(":/stylesheets/vendor-partsolutions.css");
//Q_INIT_RESOURCE(ads); // If static linked.
QFile f(":ads/stylesheets/default-windows.css");
if (f.open(QFile::ReadOnly))
{
QByteArray ba = f.readAll();
const QByteArray ba = f.readAll();
f.close();
a.setStyleSheet(QString(ba));
}
@ -20,7 +19,6 @@ static void initStyleSheet(QApplication& a)
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//Q_INIT_RESOURCE(ads);
a.setQuitOnLastWindowClosed(true);
initStyleSheet(a);

View File

@ -1,5 +1,5 @@
# Advanced Docking System
![Travis Build](https://travis-ci.org/mfreiholz/Qt-Advanced-Docking-System.svg?branch=master)
[![Travis Build](https://travis-ci.org/mfreiholz/Qt-Advanced-Docking-System.svg?branch=master)](https://travis-ci.org/mfreiholz/Qt-Advanced-Docking-System)
Manages content widgets more like Visual Studio or similar programs.
I also try to get everything done with basic Qt functionality.
@ -59,6 +59,29 @@ MyWindow::MyWindow(QWidget* parent) : QMainWindow(parent)
_sc1 = ADS_NS::SectionContent::newSectionContent(QString("Unique-Internal-Name"), _container, new QLabel("Visible Title"), new QLabel("Content Widget"));
_container->addSectionContent(_sc1, NULL, ADS_NS::CenterDropArea);
}
static void initStyleSheet(QApplication& a)
{
//Q_INIT_RESOURCE(ads); // If static linked.
QFile f(":ads/stylesheets/default-windows.css");
if (f.open(QFile::ReadOnly))
{
const QByteArray ba = f.readAll();
f.close();
a.setStyleSheet(QString(ba));
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setQuitOnLastWindowClosed(true);
initStyleSheet(a);
MainWindow mw;
mw.show();
return a.exec();
}
```
## Developers