I am creating an application that uses Qtxlsx writer to transfer data from excel to my own datatype. Can I simply #include the QVariant Class headers or any Q classes headers I need into excel?
You should use Qt Xlsx module as described there. The library supposed to be used in your project just like a set of source code files. And, of course, you can include any headers in your Qt application.
Related
Is there any way how to implement dynamical file-resolver for missing Qml components in QmlEngine? How to implement dynamically loading of external resources to QmlEngine?
I can use following snippet to load qml component from any data stream:
QUrl uri(...)
QByteArray data(...);
QQmlComponent::setData(data,uri);
but when passed component refers to another one (not already loaded), QmlEngine stopped because of missing resource.
Is there any event/callback where it is possible to handle such missing resource?
Added use-case scenario:
We're developing some QML visual components. Some components are implemented as .qml files and some as QQuickItem.
For example imagine following situation (it's very simplified):
QmlItem "DiagramPoint", implemented in point.qml
QmlItem "Line" implemented in line.qml, class is using "DiagramPoint" item
QQuickItem (c++) "ConnectedLine" which internally using "Line" object
QmlProject which using "ConnectedLine" components.
In case that point.qml and line.qml are located on hdd or stored inside Qt Resources, everything works automatically. But what we would like to achieve is to store these files in encrypted form in our internal .dat file and decode it only on demand.
We're able to decode and load "Line" object from "ConnectedLine" implementation. But in case that "Line" (line.qml) depends on another encrypted file "DiagramPoint" (point.qml), this solution doesn't work.
Another possible solution
Another solution could be to register all decrypted .qml files on application startup and than use it. Something simillar to qmlRegisterType which allows to register c++ QQuickItems to QmlEngine.
Unfortunately none of these methods allow to register Qml snippet from string buffer.
I'm still a bit unsure about how you would do this, but you might find QQmlAbstractUrlInterceptor useful:
QQmlAbstractUrlInterceptor is an interface which can be used to alter URLs before they are used by the QML engine. This is primarily useful for altering file urls into other file urls, such as selecting different graphical assets for the current platform.
Relative URLs are intercepted after being resolved against the file path of the current QML context. URL interception also occurs after setting the base path for a loaded QML file. This means that the content loaded for that QML file uses the intercepted URL, but inside the file the pre-intercepted URL is used for resolving relative paths. This allows for interception of .qml file loading without needing all paths (or local types) inside intercepted content to insert a different relative path.
Compared to setNetworkAccessManagerFactory, QQmlAbstractUrlInterceptor affects all URLs and paths, including local files and embedded resource files. QQmlAbstractUrlInterceptor is synchronous, and for asynchronous files must return a url with an asynchronous scheme (such as http or a custom scheme handled by your own custom QNetworkAccessManager). You can use a QQmlAbstractUrlInterceptor to change file URLs into networked URLs which are handled by your own custom QNetworkAccessManager.
To implement support for a custom networked scheme, see setNetworkAccessManagerFactory.
It says that its synchronous, so perhaps you could decode the QML files when the URLs are intercepted to ensure that they exist?
I am trying to achieve globalization in a .NET class library. In a .NET web application this seems to work fine. I can add multiple resource files under the App_GlobalResources.
e.g.
LocalizedText.resx
LocalizedText.fr.resx
However resource files are handled differently in Class Libraries. I add a resource file by
1) Opening the Properties for the Class Library
2) Clicking on the Resources Tab
3) Clicking on the link to create a “default resources file”
With this model it seems to only want to allow one default resources file. I can rename files and seem to get around this “one file” limitation but if I produce resource files with the same names as above there appears to be no code generated for the “LocalizedText.fr.resx” file. If I reference a string in code like so…
myControl.Text = Properties.LocalizedText.MyLocalizedText;
It references the LocalizedText.resx file for the value (ignoring the fact that I have the culture set to French). I’m guessing that whatever auto-generates the code for the designer file sees that there is already a “LocalizedText” class and doesn’t generate the necessary code.
Is there not a way (equivalent to the web application project) that I can use multiple resource files in a Class Library, named differently for each culture, and be able to easily access this in code (trusting .NET to switch appropriately depending on the culture info)?
Many Thanks
First: create a folder in your project named 'MyFolder'.
Second: add a resource file named 'MyResourceFile' to the folder.
Third: where you want access the resource values, import:
using System.Reflection;
using System.Resources;
using MyProject.MyFolder.MyResourceFile;
and create a property that can access the your resource. Like this:
public static ResourceManager oResourceManager = new ResourceManager("MyProject.MyFolder.MyResourceFile", typeof(MyResourceFile).Assembly);
Fourth: Get the data from your property:
oResourceManager.GetString("ResourceKey", System.Globalization.CultureInfo.CurrentCulture);
I've developed a program and I am trying to make this program work with a controllable light source manufactured by some other company. I've emailed the company and they have agreed to send me their external library as a DLL.
I have developed all of my software using Qt 4.8.1 and it has been compiled using MSVC2008.
The controllable light's DLL was compiled in Visual Studio 2008 and was written in either C++ or C# (the manufacturer is uncertain). All I have been given is the DLL and a text file saying that I must:
Add the DLL as a reference to my project
Add using LightName; to the top of the class
Instantiate an instance of the object like so: LightName *ln = new LightName();
Call function void turnOn() with the newly created LightName instance.
Firstly, I find it odd that an external library requires me to instantiate an instance of their object especially when its for a simple piece of hardware.
Secondly, the other company has provided me with no interface files.
My question is:
How can I possibly link to a C++ DLL and expose the functions nested in this library without having an interface header file in a Qt environment? Is there someway to make an interface for an external library?
I have already attempted using QLibrary and doing the following:
QLibrary myLib("mylib");
typedef void (*MyPrototype)();
MyPrototype myFunction = (MyPrototype) myLib.resolve("mysymbol");
if (myFunction)
myFunction();
However, this doesn't work because the DLL I was given was not a C DLL and I have no interface so Qt doesn't have a clue about what symbols it needs to resolve.
I've attempted to display all the definitions exported from my DLL using the dumpbin /EXPORTS command. Unfortunately this was unable to produce anything. I was hoping that I would get some sort of mangled C++ from this that I could then unscramble to make my own header.
I've attempted to use the dependency walker(very useful tool) however it couldn't resolve any symbols to give me some function definitions.
QLibrary only helps you if the library has functions exported as C symbols. If that is C++ you can dump the symbol table and look if that is sufficient for you. Names must be demangled: try to look for dumpbin or similar. It is however possible that you can't do this, it depends on how the symbols have been defined. In that case you'll have to ask for the header: read this.
Well it's absolutely legal to ask you for "instantiating an instance of their object". It's been simply their design decision to make the dll interface object oriented (as contrary to plain extern "C"). QtCore.dll is just someone else's DLL too, and you are instantiating their objects all the time.
But it also means that you will have harder time to call the DLL. The symbols are not "C" symbols (you can't export class that way) so QLibrary can't do anything for you. You can try dumpbin /EXPORTS from the DLL and then tediously unmangle them to reconstruct the class declaration. Luckily there are tools to help you (even online)
But not providing a header file for such DLL is completely dumb in the first place.
I want a web application in ASP.NET(any version below VS 2010) in which i can create a xml file and edit its node and enter values and save that modified xml.
Somewhat similar to the tool found at below link:
http://finaldownload.com/components_libraries_xml_viewer-23601-download.html
Use the builtin XMLReader/XMLWriter in .NET.
Examples:
http://www.stardeveloper.com/articles/display.html?article=2009030701&page=1
http://www.xmlplease.com/create-xml-writer
https://web.archive.org/web/20210323155432/http://www.4guysfromrolla.com/articles/092403-1.aspx
http://www.google.com/search?q=asp.net+read+write+xml
I want to create a file and write some data (userid) into the file at first run of my application, during the second run all the operation (will go to the next state) based on the file data, is it possible? How to create and write data into file?
It depends if you're working on a pure-Flex or an AIR project.
If you are making an AIR application, you can access local files using the File class (more informations can be found here and here) ;
If not, you'll have to use a server-side script (PHP, ColdFusion, Java EE...) to do the job, calling it using a HTTPService object for instance.
If you are not concerned about file's location and max content of file is less than 100 KB then you may make use of Shared Objects in flash.