Results 1 to 20 of 54

Thread: Still need help: Best way to have application "skins"?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Still need help: Best way to have application "skins"?

    Quote Originally Posted by codeslicer View Post
    Ok, I'm sorry but I don't understand what you mean by having a base and 2 subclasses...
    Hmm... you know what a "class" in object oriented language is, right?

    I have 2 seperate ui files with different styles. The "plain" one contains just the essentials, nothing more than a simple form with no style whats so ever(Other than the style Qt gives to it at run time, based on the OS). Then, I have a "fancy" one which includes the core functions and buttons, etc, but also contains some different actions in the constructor(like setMask()). It also has a different style, like different images, integrated style sheets in Qt Designer, and more.
    Yes, I have read what you had written

    In my program I want to let the user chose which style he wants. After he chooses, the program restarts, and reads from QSettings what he wants. If it's the fancy style, the program should read the "fancy" ui file and perform extra operations on the main window, in addition to the core commands.
    However, if it's plain, then the program should read the "plain" ui file, and only do the core commands.
    Do both these UI contain the same widgets (just positioned or styled differently)? Could you maybe attach them to your post so that we may have a look at them? If you only wish to change the look of your widget, you don't need two separate UI files - you can apply different stylesheets on the same set of widgets or set a different style on the widget.

  2. The following user says thank you to wysota for this useful post:

    codeslicer (24th February 2008)

  3. #2
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Re: Still need help: Best way to have application "skins"?

    I kinda want to keep it a secret for now...

    But my two ui files are different, yet same. Here's what I mean.

    In the plain one, all I have is a tabwidget and several group boxes w/different buttons and such.

    Now in the fancy one, I still have that same tab widget, But it is surrounded by a layout of QLabels, which, combined with setMask(), form the dialog's unique display. So in other words, it still contains the same objects, but more, with more styles and images.

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

    Default Re: Still need help: Best way to have application "skins"?

    Quote Originally Posted by codeslicer View Post
    I kinda want to keep it a secret for now...
    I'm going to keep the solution a secret as well then. Most probably (with about 99.9% probability) you don't need two UI files, one is enough to obtain both modes.

  5. #4
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: Still need help: Best way to have application "skins"?

    Well, either I'm wrong, or I have a 0.01 chance of getting this right. Attached, you will find screen shots of my program(Yes it might look a bit "weird" but here it is...)
    Last edited by high_flyer; 27th February 2008 at 09:49. Reason: image removed due to poster request

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

    Default Re: Still need help: Best way to have application "skins"?

    Yes, you can do that using a single UI. Attached you'll find a UI with two different stylesheets set. Combined with setMask you'll achieve the effect you want.
    Attached Images Attached Images

  7. #6
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Still need help: Best way to have application "skins"?

    Well, those "borders" are images. Also, they need to dynamically expand, so there are severl of them, all different. Using stylesheets, would I just set the QLabel image to nothing?

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

    Default Re: Still need help: Best way to have application "skins"?

    Quote Originally Posted by codeslicer View Post
    Well, those "borders" are images. Also, they need to dynamically expand, so there are severl of them, all different.
    It's all achievable using style sheets.

  9. The following user says thank you to wysota for this useful post:

    codeslicer (24th February 2008)

  10. #8
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Still need help: Best way to have application "skins"?

    Thanks, I'll try that.

    But what should I do, create "placeholders" for those images?

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

    Default Re: Still need help: Best way to have application "skins"?

    No. Just style the form or put a frame in the form and style it like I did in the images I posted "border" and "border-image" statements are your friends.

  12. #10
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default

    How do I have multiple border images, ie some images have to be fixed size while the others have to stretch.

    My form has to be dynamic, different fonts are used on different OS's, so I can't create one big image...
    Last edited by wysota; 24th February 2008 at 15:20. Reason: Posts merged

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

    Default Re: Still need help: Best way to have application "skins"?

    Quote Originally Posted by codeslicer View Post
    How do I have multiple border images, ie some images have to be fixed size while the others have to stretch.
    See the docs for border-image.

  14. The following user says thank you to wysota for this useful post:

    codeslicer (24th February 2008)

  15. #12
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: Still need help: Best way to have application "skins"?

    Wow, I guess that's why you're a guru

    Thanks a lot =]

    I guess I'll still use the functions setPlainMode() and setFancyMode() and based on that set and remove masks, etc.

    How would I set masks on the border image though? And would the "stand" (See picture in previous post) be put in the border image, or should it be seperate? Thanks again

Similar Threads

  1. dll + application
    By fpujol in forum Qt Programming
    Replies: 11
    Last Post: 15th April 2007, 18:37
  2. Application deployment problem
    By shapirlex in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 13th April 2007, 00:11
  3. Replies: 3
    Last Post: 8th December 2006, 18:51
  4. Replies: 3
    Last Post: 31st March 2006, 18:38

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
  •  
Qt is a trademark of The Qt Company.