setTabChangesFocus(bool) has no effect Qt - qt

I need to forbid the tab input in a QPlainTextEdit widget. Instead tab should be used has a "focus next" widget. It seems that setTabChangesFocus(bool) is made for that but setting it to true has no effect. I guess it's a Qt bug. Did anyone experiences the same issue and find a solution?
I'm using Qt 4.5.2 on snow leopard.
Thanks,
Boris

The correct solution to this is to use a focus proxy widget. See:
http://doc.qt.io/qt-4.8/qwidget.html#setFocusProxy

I'm using Qt 4.5.3 and I quickly tested it in my app, you're absolutely right, setTabChangesFocus(true) should switch from "tab into the TextEdit" to "tab to change focus"...
I'm on windows XP tho, did you reimplement QPlainTextEdit ?
In the meantime, if you really don't find the source of your problem, you could maybe use a EventFilter...

Thanks Andy, I actually found a solution. It seems that you need to put it inside another widget (a groupbox for example) and it should work.
Boris.

Related

Different look of QSpinBox on MacOs

I developed a simple QT application on Windows using QT creator 5.8 with good result. I used a simple form with QSpinBox.
To fix the color of the QSpinBox I wrote in the related style sheet
color:rgb(255,255,255);
Then I moved the application on MaxOs but the look of QSpinBox changed.
Did you have a similar problem ? How did you fix it ?
Thank you very much for your help and cooperation
regards
This is because the QWidget appearance actually depends on the platform. One (limited) solution is to use the palette, with setForegroundRole
The other is to use stylesheets, like you did, but you very likely will have to redefine more to obtain the desired result, and result will of course depend on the platform. You can actually make the result completely custom using only stylesheet. Just make sure to set the "border" style to avoid problems.
Here is Qt documentation about style sheets: Qt StyleSheets

Console/Terminal Widget for Qt?

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.

Looking for QML scrollBar component

Who knows QML scrollbar component with the standard Windows style?
See the blog entry QML Components for Desktop? in the Qt Labs Blog. But beware: this is unfinished code and in my installation (Qt 4.7.2, Vista, MSVC-2008) the example did not work out of the box for me.
You probably don't need this anymore, but I just stumbled into the same problem and this post might be useful to whoever have the same needs. It contains a scrollbar qml source that worked pretty well for me. It doesn't have the standard windows style though, so you'd have to tweak its appearance a little.

Does Qt support ribbon control?

Does Qt support ribbon control?
I want to share with you the link to site has published screenshots of their component Qtitan Ribbon for Qt.
http://www.devmachines.com/qtitanribbon-overview.html
While there is no dedicated Ribbon widget in Qt, you can fashion something similar yourself. You could take a QTabWidget and put some buttons inside (and optionally style it to look a bit more like Microsoft's Ribbon). Depending on what you're trying to accomplish, that might suffice.
One of their sample apps apparently has a ribbon, so it should be do-able.
http://qt.nokia.com/images/products/vtk-designer-opengl-screenshot
You can take any JavaScript/JQuery ribbon, insert it into QWebView and do whatever you want with it, using the Qt Webkit Bridge.
There is no Qt ribbon control.
I believe there are license issues preventing Nokia from developing a ribbon control that is similar to Microsofts.
There are free alternatives to QtitanRibbon by now, for example, checkout:
https://github.com/martijnkoopman/Qt-Ribbon-Widget
You can even directly use it in any *.ui file!
Simply add a QTabWidget in QtDesigner and then promote that widget to the Ribbon class.
No, it doesn't. I didn't find out any plan to support it in the future.
We use QtitanRibbon, and it works very well for us. Support has been good, documentation on the short side. Worth noting that it not only provides a ribbon UI, it also makes it convenient to implement dark mode (or in our case, we opted for grey mode).

Qt QFileDialog input field - tab complete like shell

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.

Resources