Qt "QTextEdit" Functions - qt

Well, i'm doing an IDE System. Basically, everything works Fine. Though, but i have a problem. The class "QTextEdit" doesn't have the member "setCompleter" which is for autocomplete. Right?
Well, is some class that supports it including all QTextEdit members?
PS: Any better way to do Autocomplete? I've asked this before, but i heard you can do it with QReg , but no idea.
Thanks!

The Qt documentation has an example on how to extend QTextEdit with a custom auto-completer here: http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-example.html

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

What happened to QListViewItem in qt4?

I don't do a lot of Qt programming so this may sound like a silly question, but what happened to QListViewItem in qt4?
I have this application I wrote some time ago in qt3. I changed that to qt4 using the aptly name "qt3toqt4" program (all this on a Fedora platform).
Internally it seems to change a lot of classes from QClass to Q3Class (probably to provide some sort of backwards compatibility) and then compile it with qt4. I had some problems with it today (to do with reading stdout from a QProcess, but that aside) and I decided to simply rewrite the application in qt4.
Now for the problem - I use a QListView and to this I add loads of QListViewItems in a tree like structure. Something like this:
But that doesn't seem to be available anymore in qt4. And I can't find any examples that provide this behaviour either. Is there a way to do this in qt4? To maybe make it more complicated - I used my own QListViewItems (derived from QListViewItem) ...
The widget you are looking for in Qt 4 is QListWidget and its item class QListWidgetItem. It pretty much corresponds to the QListView widget in Qt 3 with a classic item-based interface for adding and removing items. You can subclass QListWidgetItem just as you subclassed QListViewItem in Qt 3.
Just to complete this question. It is QTreeWidget and QTreeWidgetItem that implement this behaviour in qt4.

How to use custom widget in Qt-Designer

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).

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.

Hierarchy in Qt [C++]

Guys could any one point it out to me a link to web page where I can find a hierarchy of classes in Qt, preferably as a diagram (something in UML style)? I'm just starting to learn it and I'm finding it quite difficult to work with all these classes - well, mainly with widgets and layouts at the moment- without knowing where they belong.
Thank you.
The official class hierarchy is found here:
http://doc.qt.io/qt-4.8/hierarchy.html
There are also some class charts. It is really big, you need a plotter to print this in a size which is readable:
http://doc.qt.digia.com/extras/qt43-class-chart.pdf
I was looking for the same thing but for QT 5.3. If anyone is interested here you have the class hierarchy for last QT version.
http://qt-project.org/doc/qt-5/hierarchy.html
Unfortunately, the classes diagram does not exist as it is mention here.

Resources