I've got a basic PyQt QFileDialog file browser goin in Python, Kubuntu.
My issue is I would like the "tab key" in the file input to act as tab-complete does in a shell.
Is there any way to accomplish this?
From a UI/UX standpoint are you sure that's what you want? In forms and dialogs tab has traditionally meant go to next field. You might be confusing the user. Or you might start a revolution in User Experience for forms :-)
Just curious if that's what you really want?
You will have to subclass the QFileDialog, and change the behavior. It will probably not be easy.
I haven't made use of PyQt yet, but I think the QCompleter class might be most of the way to what you want:
http://doc.trolltech.com/4.5/tools-completer.html
I don't know if it tab completes or if that's something you'd have to add yourself.
I am not sure you can actually, i don't see any access to the input field in the documentation of QFileDialog. Qt is fairly aggressive at hiding implementation detail from it's users. You might be able to do this by taking the implementation of QFileDialog (C++) and modify it for your purpose.
Related
We need a tree view with File system and check boxes in QT. Is there any way to achieve that?
The tree we need would look something like below:
UPDATE:
I am able to achieve it with subclass of QFileSystemModel. Still have few challenges, but at least subclass is working. Below is the code if anyone needs it. Below is the link to the code -
https://drive.google.com/file/d/1qViZ3iEW2pV2th0jQhzneDL14SEhIgS0/view?usp=sharing
The pending work is to apply a wait cursor (or make treeview uneditable when the check/uncheck is taking place).
PS: It will take a lot of time if root node is checked.
Well, all of that can be achieved with minimal customizations of built-in classes, actually those checkboxes is almost the only thing that has to be done yourself.
QFileSystemModel already provides a proper model for displaying the current filesystem contents, it can be subclassed
As for QML, the best demo is already provided by Qt, check the File System Browser Example. This example uses some deprecaded Qt functionality, but still it shows the basic concept.
The modern techniqes can be also found in the answers to the following question: Qt File Browser based on QML
Hopefully, all that helps you, good luck!
I want to use a custom widget in the GUI-Designer of Qt-Creator IDE.
So i created a class which inherits from Qt's QWidget. It worked to place
it on a QMainWindow programaticaly, but have to do my work in the desiger
where it does not appear as an option in the kist of components.
I googled to find a solution for problem an found an manual on, who guesses, the
Qt doc page ( https://doc.qt.io/archives/qt-4.7/designer-creating-custom-widgets.html
and https://doc.qt.io/archives/qt-4.7/designer-creating-custom-widgets.html).
I tried to follow it but doesn't work.
Does someone know an other way to do this or can give a hint where i can search
for problems following this tutorial?
Thanks in advance.
Codierknecht
There is a different example in the examples section of the Qt documentation that I think is a lot clearer.
Custom Widget Plugin Example
It was a little unclear to me when reading the tutorial where the Q_EXPORT_PLUGIN2() macro goes, but having full example code and project alleviates that.
If you are like me, the analog clock example didn't do it for you, in which case I found just one better tutorial. It may be on the kde site but I you dont need kde to do it, it just explains how to make the custom widget a plugin so you can add it into Qt Designer, rather than having to code it in, which is the norm when you just add a widget to your project and customize the class. I hope this page helps you like it helped me, get in the right direction of writing a single Qt Designer (or multiple) plugin:
Writing Qt Designer Plugins
If this link ever becomes dead, just do a search for the link itself, usually that will turn up the original page in someone's cache, as they do in the other examples above (the dead links in the above answers that just take you to main area and not to the pages originally intended).
Anyone know of any widget in Qt4 that acts as a terminal/console? Open-source would be good.
Thanks in advance.
QConsole used to do something like that. (Not sure the project is active anymore, but you might want to have a look).
Found some decent source code here. Very basic functionality, but I've been adding to it some and I think it has promise to do what I need it to.
NOTE: I have only tested this code in Win32.
Here is a link to my new question concerning this code.
If you are on Qt6, you can use the QLightTerminal.
If you're on Qt5 now, there's the QTermWidget widget from the LXQt project.
We're running one of our apps on a 8" touch screen and want to add help to it.
Launching Qt Assistant from a menu item works fine for desktop applications, but for touch applications it's far from ideal.
I haven't been able to figure out if it is possible, or permitted to do so?
QAssistant.exe itself seems to come with some license restrictions, but maybe there's another way to do this, like embedding a small web-browser or something.
Have anyone else tackled this, or something similar?
Check out how QtCreator does this, they have integrated QtHelp which looks exactly like what you're trying to do. The library they use for that is the QtHelp module (I think).
You should check the documentation for QHelpEngine and QHelpContentWidget. I think that these classes will meet your needs.
Another way would be to actually see how Qt Assistant is implemented, by looking at the source.
How do I change the icons to Alert buttons like OK, CANCEL etc?
If you look at the source code for Alert there really isn't a lot there once you get past the comments and properties. What I've done in the past is to just copy the Alert class and modify my custom version however I see fit. That way you don't have to deal with the mx_internal stuff. If you are using Flex 4, there is no spark version of Alert, so another thing you can do is create your own spark version, which will give you even more control over skinning your alerts using skins etc. Sounds like a big deal, but it's actually much easier than you'd think (speaking from experience here.)
Just specify the iconClass paremeter of the Alert class. A detailed example can be found here.
You can find a complete source code and application example here