I am using external css to theme my GTK3 application (on windows 7, 64bits)
also I am using xml file that describes all the widgets in the application
both of these two files (.css & .xml) are used during runtime of my application (.exe)
my question: how to compile my application so that it will no longer depend on the css and xml files ?
Put the files inside a GResource and compile them directly into your program.
The documentation explains it well enough, but basically you generate a resource.c and resource.h file during your build process, that encode the external files. Then you compile those files into your program, and they will be available through a URI such as resource:///com/example/yourprogram/yourwidgets.xml.
Related
Here is my need:
I have created a angular library which is used by number of applications. the library has the all styles file as ".scss" extension. in case of any update in library each application require to build the angular-library, instead I decided to keep the library scss/css files in server. so it will automatically updated with all apps.
as a try i uploaded the '.scss' file, but it's not working after i added the file in index.html
the question is:
how to include the style.scss file in other applications - if not possible then
hot to convert scss files in to css file while i do library build and same can uploaded in server
please help me.
at the root of project in angular.json u can add styles files from libraries (like global syle.scss) and angular application will convert them automatically
I have QML file that has been embedded into a dll. I think it was done something like this
How can I embed a Qt resource into a .dll file?
(The second answer).
Is there anyway to split out the QML file to obtain the source code? I am not very familiar with QT framework
If it's embedded via *.qrc, then it's NOT compatible with standard windows/linux (.dll/.so) resource formats. qrc is compiled as xxx_qrc.cpp file and embedded by linker as .obj file with static initialization code. I.e. it's just part of the binary. You can access "contents" of qrc via QFile with "qrc:/." URL. But for that, you have to load DLL with resources embedded in current process, because qrc is hooked up in static initialization (aka DllMain in Windows). Something like:
QLibrary lib("./library.dll");
if (!lib.load())
throw exception(lib.errorString().toStdString());
QFile resource(":/resource.qml");
if (!resource.open(QIODevice::ReadOnly))
throw exception(resource.errorString().toStdString());
resource.copy("./exported.qml");
To explore currently loaded virtual qrc file system tree, you can use QDir(":/"). I guess it's pretty easy to figure out the rest from here.
And of course - you have to be aware what sort of DLLs you are loading into your process, as they may contain arbitrary code that will be executed as you call QLibrary::load!
In a Vaadin 14 web app project created by the "Plain Java Servlet" flavor of the Vaadin Starter page, there are numerous folders automatically created by the Maven POM file process.
Where is the place to put a data file or configuration file that I will load and parse when my web app launches? Under what folder do I put my files? Should I create further nested folders? And by what file path name do I find and load such a text (XML, JSON, CSV, etc.) file?
Location of file
You put them in src/main/resources as it is the convention also outside of a Vaadin application.
Vaadin adds several other resource roots for things that later end up in places in the jar, that are conventient for vaadin to find (e.g. under META-INF/resources/...).
resources still ends up in the root of the jar or get properly "classpathed" by the build-tools and is safe to load non-classes via the classloader in your application.
Opening file
You can open your text file from there by calling Class::getResourceAsStream, returning an InputStream. Note the leading slash character.
InputStream inputStream = this.getClass().getResourceAsStream( "/myfile.txt" ) ;
I'm using QWebView to run a web app. There are 650+ files. Placing the web app's directory in the source directory does not result in the executable bundling the directory.
How do I include the entire web app directory so that the executable will be able to render the files.
Note: I have currently added index.html as a resource, and can access it with qrc:// - But since I cannot add the entire directory structure to a qrc (can I?), the executable does not include the other files.
You need to put an XML node into the .qrc file for each file you want to use using the Qt resource system.
This can be done using a simple pre-build script. Take a look at qrcgen. Quoting the blog post behind this link:
The script I created, qrcgen, takes a directory and a prefix, recursively scans the directory and generates a .qrc file with the same name as the directory scanned. It has solved my problem, and I hope it can help others. It is also available via PyPI, just "easy_install qrcgen".
In order to update the .qrc file whenever your directory contens change, you need to include this step into your build process:
For C++/Qt projects, you can add this step in the build configuration in QtCreator or add in your qmake file a system(...) statement. Note that such commands aren't portable in general. (If it's not portable, you can put some operating system conditions around multiple commands.)
For PyQt/PySide projects, I don't know how to do this, but I'm sure you find a solution for this too.
I understand that in Flex builder we can right click on a CSS file and choose 'compile to swf' and our CSS SWFs will automatically be compiled along with the main app.
Is possible to compile the CSS file only (not with the main app) from the command line?
I want to :
Give clients a Flex CSS file to hand edit
Allow them to upload the file via a CMS
Trigger a server process to run the compiler from the command line, outputting the compiled SWF to the appropriate server path.
This would of course be a whole lot simpler if Flex properly supported text-based CSS files (without requiring manually applying styles using AS3).
Yes, it is possible and really easy just type:
mxmlc yourFIle.css
at the command prompt