I'd like to show a virtual file system alongside the normal file system in a qml file dialog. For that virtual file system i will use a customized class derived from qfilesystemmodel.
However how can i tell the qml file dialog to use my custom model?
I have seen in the
qml/QtQuick/Dialogs/DefaultFileDialog.qml source code, that it has a modelComponent property but I don't know how to modify that property. Can anybody help? Is this even the right way to achieve it or should it be done in another way?
Related
I need to build a custom Style for a Qt VirtualKeyboard on a small screen to maximize its readability. I have built a custom layout into my project, and using the QT_VIRTUALKEYBOARD_LAYOUT_PATH it works great.
The problem I am having is that the documentation states that the custom style must be placed in the Qt Directory. I need this style to be portable, however, so storing this newly built style on my local machine, rather than in the project itself, will not be acceptable.
Is there any way to build a use a keyboard style within a project?
It doesn't have to be in the Qt directory, just in a directory that is under QtQuick/VirtualKeyboard/Styles/ and in the QML import path.
As an example, take a look at the auto test:
http://code.qt.io/cgit/qt/qtvirtualkeyboard.git/tree/tests/auto/styles/data
You can also put the style in a .qrc file under that folder structure:
http://code.qt.io/cgit/qt/qtvirtualkeyboard.git/tree/src/virtualkeyboard/virtualkeyboardsettings.cpp#n70
I've created a task to make this clearer: https://bugreports.qt.io/browse/QTBUG-66172
My app was started (by someone else) in Qt Designer. For a number of reasons I've decided to put the main form gui together in C++. In the designed I deleted all the gui widgets and removed the menu items from the object tree.
Having got the layout how I want it I started adding in the actions to find that they are still declared in the ui_mainwindow.h file.
Is it safe to manually remove the action declarations from this file? Or is there a way of doing this through Qt designer?
Open your *.ui file in the designer. In the lower right corner you'll see Action Editor. Actions can be deleted from there.
I would like to display .qhc files into my QML/QtQuick application, does anyone tried to do that?
I know that I can use QHelpEngine on the C++ part, but I would like to use qhc files directly on QML.
Hello can anyone tell me how can I open a specified folder in Qt?
Suppose in a lineEdit I define the folder path like
D:/MyFolder
Then how can i open this folder using push button?
What should I use for that?
You can use:
QDesktopServices::openUrl(QUrl::fromLocalFile(yourFolderPath));
inside a slot connected to you button.
I have a form generated dynamically from a database table model:
I there a way to save that form to a *.ui file? I want to allow user to edit that form in Qt Designer.
Presumably there must be some limitations on what your users can add and edit?
If so, then maybe you could take a more structured approach and use QWizard to provide a simple interface for designing and editing forms. The wizard would generate ui files which would then be loaded in your application using the uic module (if you're using PyQt4, that is - because it does not include the QUiLoader class).
Of course, for this to work, you would need to adapt your current procedure for dynamically generating forms so that it also works with ui files.
EDIT
It looks like QAbstractFormBuilder provides an API for both loading and saving widgets as ui files. It is part of the QtDesigner module, which is now included in PyQt4.
Having said that, my brief experimentation with the load() and save() methods did not produce very useful results - but hopefully others will have more luck.
Personally, if I was designing an application like this, I would prefer to generate the ui files myself using a suitable XML library (either Qt's, or one of the several python standard library modules). The structure of a form layout is pretty simple and regular, so the ui files should not be too difficult to replicate. The major benefit of doing things this way is that it allows for complete control over the input and output.
There is a load(), but no save() in the QUiLoader:
http://developer.qt.nokia.com/doc/qt-4.8/quiloader.html#load
The UI file format is documented, and is XML. So you could write your own .UI file generator:
http://developer.qt.nokia.com/doc/qt-4.8/designer-ui-file-format.html
In fact, you could attack this problem the other way around. Instead of generating the dialog using programmatic widget API calls...instead generate a .UI file with XML. Then you can load it in your app or through QtDesigner.
(Depending on what your app is or is intended to do, you might also look into rethinking it as a QtDesigner plug-in...in which case this functionality might come for free.)