Results 1 to 11 of 11

Thread: Styles - building

  1. #1
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Styles - building

    Hi. I've gotta question. How can I build (not launch) program in plastique style?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Styles - building

    You can't "build" an application in particular style. You can just use QApplication::setStyle() to force a style in your application.

  3. #3
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Styles - building

    Can I do it in designer? If not, how can I set style to application which code was created by designer?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Styles - building

    As I said - use QApplication::setStyle in your code (for example in main()) and make sure you do it before creating QApplication instance so that the user can override your choice by using the -style switch.

  5. #5
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Styles - building

    Hmm...I don't understand...How can I do it in my case? My main.cpp file:
    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "maker.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication app(argc, argv);
    8. MainWindow MainWindow;
    9. MainWindow.show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Styles - building

    Quote Originally Posted by Salazaar View Post
    Hmm...I don't understand...How can I do it in my case? My main.cpp file:
    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "maker.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication app(argc, argv);
    8. MainWindow MainWindow;
    9. MainWindow.show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    Call QApplication::setStyle ( new QPlastiqueStyle() ) in main, just before creating QApplication.

  7. #7
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Styles - building

    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "maker.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication::setStyle ( new QPlastiqueStyle() )
    8. QApplication app(argc, argv);
    9. MainWindow MainWindow;
    10. MainWindow.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    is that correct?

  8. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Styles - building

    Yes. Don't forget ; after the line you just added, and aslo include <QPlastiqueStyle>.

    Regards

  9. #9
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Styles - building

    thanks for a tip

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Styles - building

    I'm sorry, but I just can't resist myself from asking... What are your C++ skills?

  11. #11
    Join Date
    May 2007
    Posts
    315
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Styles - building

    I'm just a bit scatterbrained

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.