PDA

View Full Version : Must I include each widget header with qt5?



aguayro
26th December 2012, 01:23
In qt4, we could include <QtGui> and automatically QToolButton, QpushButton, QLineEdit, and a lot more widgets were included too.
In qt5, do i need include each widget? #include <QToolButtom>, #include <QLineEdit>, e ctc... ? is there any "fast" way to include common widgets?

Zlatomir
26th December 2012, 10:35
In Qt 5 the module for widgets is widgets so use: #include <QtWidgets>

aguayro
26th December 2012, 12:25
Oh thanks!! That helped :)

Another question, it's me? Or the autocompletion in QtCreator its slower? It's takes aout 2 seconds to load the popup containing the list of possible completions.

Zlatomir
26th December 2012, 13:44
Try to include only the headers you need (each widget header you actually use) instead all the headers from QtWidgets module and see what happens. //also do the same for all other modules you use in your project.

aguayro
26th December 2012, 13:53
Thanks again!!

Zlatomir
26th December 2012, 14:03
Thanks again!!
Does this mean it works, or at least it working a little bit better, or you are just being nice because i tried to help?
Please share for others that will read this later and might have the same problem.

aguayro
26th December 2012, 23:43
It's works, its fastr if only include the used widgets.

I'm having another battle now, with the styles. Seems something has changed, can't include none of QWidowsVistaStyle, QPlastiqueStyle, etc... tryed QFusionStyle but doesn't exist.
I've been googling for Qt5 Style system changes but nothing found. Some information on qt blog about "cleaning styles" and fusion style, but nothing about how the Style system works now.

anda_skoa
27th December 2012, 10:06
The headers of the concrete style implementations are "private" and not installed.

If you need a base class for an own style you can use QCommonStyle.
If you want to create a style at runtime, just use QApplication::setStyle(QString) or QStyleFactory::create(QString) and the style's name.

Cheers,
_

aguayro
27th December 2012, 15:53
Thanks a lot! it works fine with: QApplication::setStyle("Fusion");

Thanks for all answers.