Results 1 to 5 of 5

Thread: How can i use QSettings in my MFC application?

  1. #1
    Join Date
    Jul 2011
    Posts
    3
    Qt products
    Qt4

    Default How can i use QSettings in my MFC application?

    is it possible? if yes how will i need to declare the class,object and include what headers in my initialization func of my mfc main class? thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How can i use QSettings in my MFC application?

    is it possible?
    Yes, but the question is why do you want to mix MFC and Qt?
    You better stay with one of the two all the way, mixing them is asking for trouble.
    if yes how will i need to declare the class,object and include what headers in my initialization func of my mfc main class?
    Qt is a library, just like any other (in general).
    So you will have to link to Qt.
    As long as you don't use signals and slots, and really just use QSettings, you might get away with out the need to construct QCoreApplication object.
    You will have to include <QSettings>.
    For using QSettings, read here : QSettings.
    There may come some other problems - you are welcome to try and see.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jul 2011
    Posts
    3
    Qt products
    Qt4

    Default Re: How can i use QSettings in my MFC application?

    Quote Originally Posted by high_flyer View Post
    Yes, but the question is why do you want to mix MFC and Qt?
    You better stay with one of the two all the way, mixing them is asking for trouble.

    Qt is a library, just like any other (in general).
    So you will have to link to Qt.
    As long as you don't use signals and slots, and really just use QSettings, you might get away with out the need to construct QCoreApplication object.
    You will have to include <QSettings>.
    For using QSettings, read here : QSettings.
    There may come some other problems - you are welcome to try and see.
    thanks for your reply!!
    btw if i want to use QTimer too, there is the signal and slot needed for the handler
    so i will need to create the QcoreApplication object?

  4. #4
    Join Date
    Jul 2011
    Posts
    3
    Qt products
    Qt4

    Default Re: How can i use QSettings in my MFC application?

    I'm having this problem when i try to #include <QSettings> in my application

    1>c:\qt\4.6.2\include\qtcore\../../src/corelib/io/qsettings.h(45) : fatal error C1083: Cannot open include file: 'QtCore/qobject.h': No such file or directory

    i checked the files in there and qobject.h is in QtCore folder, so whats what now? anyone help?

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How can i use QSettings in my MFC application?

    btw if i want to use QTimer too, there is the signal and slot needed for the handler
    so i will need to create the QcoreApplication object?
    Yes.

    i checked the files in there and qobject.h is in QtCore folder, so whats what now? anyone help?
    the ../../ should not be in the path, the path is wrong.

    You didn't answer why you are mixing MFC and Qt?
    Why not do everything in Qt?
    Will save you a lot of trouble.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QSettings - how to use?
    By almalino in forum Qt Programming
    Replies: 10
    Last Post: 22nd September 2017, 04:17
  2. Replies: 1
    Last Post: 14th January 2011, 11:57
  3. Replies: 1
    Last Post: 12th October 2010, 14:45
  4. Replies: 4
    Last Post: 15th July 2010, 14:26
  5. Migrate Qt3 QSettings to Qt4 QSettings
    By hvengel in forum Qt Programming
    Replies: 3
    Last Post: 22nd February 2008, 03:21

Tags for this Thread

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.