Results 1 to 9 of 9

Thread: Must I include each widget header with qt5?

  1. #1
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Must I include each widget header with qt5?

    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?
    Always trying to learn >.<

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Must I include each widget header with qt5?

    In Qt 5 the module for widgets is widgets so use: #include <QtWidgets>

  3. #3
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Must I include each widget header with qt5?

    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.
    Always trying to learn >.<

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Must I include each widget header with qt5?

    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.

  5. #5
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Must I include each widget header with qt5?

    Thanks again!!
    Always trying to learn >.<

  6. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Must I include each widget header with qt5?

    Quote Originally Posted by aguayro View Post
    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.

  7. #7
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Must I include each widget header with qt5?

    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.
    Always trying to learn >.<

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Must I include each widget header with qt5?

    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,
    _

  9. #9
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Must I include each widget header with qt5?

    Thanks a lot! it works fine with: QApplication::setStyle("Fusion");

    Thanks for all answers.
    Always trying to learn >.<

Similar Threads

  1. Replies: 1
    Last Post: 28th April 2012, 04:53
  2. Replies: 5
    Last Post: 16th January 2011, 16:19
  3. The header file 'mainwindow.h' doesn't include <QObject>.
    By nhs_0702 in forum Qt Programming
    Replies: 5
    Last Post: 14th May 2010, 18:02
  4. compile to arm+include header
    By nataly in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2009, 13:59
  5. unable to include header file
    By sonia in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2007, 09:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.