Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Skinned Windows (own TitleBar and Borders)

  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Skinned Windows (own TitleBar and Borders)

    This two little classes let you use own windowframes and titlebars.
    the windows which are created with this class can be resized and moved like normal windows
    and have three buttons on top. For an own skin you will need 9 pixmaps:
    -> left border(sl), left-bottom corner(elu), right-bottom corner(eru), right border(sr),
    titlebar(so), bottom corner(su)
    -> maximize (maxButton), minimize(minButton), close(quiButton)
    if you want to skin your application just set QSkinWidget as Parent. if you want to skin a MainWindow use something like this:
    Qt Code:
    1. QSkinMainWindow *wid = new QStyleMainWindow();
    2.  
    3. MainWindow mainWindow;
    4. wid->setWindowTitle(APP_TITLE);
    5. wid->setCentralWidget (&mainWindow);
    6. wid->resize(550,650);
    7. wid->show();
    To copy to clipboard, switch view to plain text mode 
    enjoy working with this classes, even its somekind of "murx".
    please let me know if you find better ways to realyze things i did in the classes and use them only for opensource-software.
    i hope i will get some feedback!
    P.S. Sorry for my bad english and no comments, i will type them as far as i can...
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    i've added resizing on every side an on the edges.
    Attached Files Attached Files

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    Now i've optimized the drawing of the Frame-Pixmaps and the resizing of the windows.
    Attached Files Attached Files

  4. #4
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    Ok. I wonder that nobody shoutet at me, because the classes didn't work on linux...
    but now they should work on all platforms.
    Please some feedback...
    Attached Files Attached Files

  5. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    Quote Originally Posted by kernel_panic View Post
    but now they should work on all platforms.
    Really? Well I got a few comments :
    • Packaging is *REAL* bad... put all three (lib, test and config) in a single package
    • Why do you feel the need to put the lib in a subfolder of its sources instead of in a subfolder of top dir?
    • there are unneeded files in test : makefile, lib bin and headers... use LIBS += -L.. (or -L../QSkinWindows/lib if you keep your current layout) and INCLUDEPATH += ../QSkinWindows
    • there is a convention to use lower case filenames to avoid errors under UNIX systems which are case-sensitive...
    • The test program crashes... It says "Floating point exception"
    • I've not seen any pixmaps anywhere... How do you style the test program?
    I guess that's all for now...
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    ups...
    ok... now it should be better.
    Attached Files Attached Files

  7. #7
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs down Re: Skinned Windows (own TitleBar and Borders)

    I do not understand... what are you "distributing"? The zip does not contain a mainlevel project file, and the project file available on the SkinConfig does not compile.

    Did you test the release? What do you expect me to do with it?

  8. #8
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Angry Re: Skinned Windows (own TitleBar and Borders)

    yes i tested it. download the newest version (tar.bz2 file). it works. with this "distribution" which is a class for adding own titlebars and borders to your application.

  9. #9
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    Just wanted to tell you that it compiles and works pretty good. Thanks.

    Whats the license of this work? Can I use it on non GPL applications?

  10. #10
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    no you can't.only for open source software, please.

  11. #11
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    The new package compiles well and looks pretty good. however the handling of mouse events (to click on buttons) doesn't seem to work well : I got warnings about QWidget::grabMouse(), the buttons are not animated and whatever the one clicked the applications gets closed... Am I missing something?
    Current Qt projects : QCodeEdit, RotiDeCode

  12. #12
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    i dont know. on my system everything wotks well, try this test-code for buttons:

    Qt Code:
    1. #include <QtGui>
    2. #include "../QSkinWindows/QSkinWidget.h"
    3. #include "../QSkinWindows/QSkinMainWindow.h"
    4. int main(int argc, char* argv[])
    5. {
    6.  
    7. QApplication a(argc, argv);
    8. a.setStyle("plastique");
    9. QSkinWidget *wid = new QSkinWidget();
    10. wid->setWindowTitle("QSkinWidget");
    11. QPushButton* pb = new QPushButton("test", wid);
    12. g->addWidget(pb);
    13. wid->setLayout(g);
    14. wid->show();
    15.  
    16. QSkinMainWindow *mw = new QSkinMainWindow();
    17. QWidget centralWidget;
    18. mw->setWindowTitle("QSkinMainWindow");
    19. QHBoxLayout *g2 = new QHBoxLayout();
    20. QPushButton* pb2 = new QPushButton("test", &centralWidget);
    21. g2->addWidget(pb2);
    22. centralWidget.setLayout(g2);
    23. mw->setCentralWidget(&centralWidget);
    24. mw->show();
    25.  
    26. return a.exec();
    27. }
    To copy to clipboard, switch view to plain text mode 
    the application should only close if you click on the "X"-Button. and i don't us grabMouse... could you post a snippet of your code or are you using my test-application?

  13. #13
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    Quote Originally Posted by kernel_panic View Post
    are you using my test-application?
    Sure! I can afford testing something but not writing an app to test it... See I'm rather busy ATM.
    Current Qt projects : QCodeEdit, RotiDeCode

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

    rvega (11th May 2012)

  15. #14
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    hey, back with something great:
    The skin-classes with argb support on windows. no faking, and no cpu overhead.
    atm the classes are ONLY FOR WINDOWS, for linux use the old ones, i will fix this and add argb support for linux, too.
    have fun.
    Attached Files Attached Files

  16. #15
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    all happy with this? nothing i could make better?
    if there are any people who are great in designing could make same skins. that would be great.

  17. #16
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default

    Excellent idea! Congratulations!

    This comes to prove that you don´t need vista OS to make well finished windows, Qt on windows 2000 is plenty enough.

    Now that it is implemented i have a few ideas...

    ************************************************** *********
    Why do you include <window.h> when there is an implemented <qt_windows.h> for those functions?

    see this example from russia:
    link: http://www.opennet.ru/docs/RUS/qt3_prog/c7922.html

    #define _WIN32_WINNT 0x0501

    #include <qapplication.h>
    #include <qt_windows.h> // <----- ********** here**********

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QLabel *label = new QLabel("Hello Qt!", 0);
    app.setMainWidget(label);

    int exstyle = GetWindowLong(label->winId(), GWL_EXSTYLE);
    exstyle |= WS_EX_LAYERED;
    SetWindowLong(label->winId(), GWL_EXSTYLE, exstyle);
    SetLayeredWindowAttributes(label->winId(), 0, 128,
    LWA_ALPHA);

    label->show();
    return app.exec();
    }

    *******************************************
    isn´t it better to use qt_windows header? or more compatible maybe......

    i think the behavior of the skinned windows can be improved.

    the problem with resizing is the following:

    the mouse switches to resize mode far from the apparent window border right at the end of the surrounding shadow which makes difficult to resize it.

    i think that the resizing could be bette is instead of this, resizing mouse icon could appear in the thin white border around the cyan dialog, or at least ther should be a value to extend the resizing area some pixels more inside the frame.

    in my opinion picking on the outside outer shadow limit for resizing is not the better behavior.

    the white border with rounded corners is very nice and there should be some way of making it thicker so it can be used for resizing.
    ************************************************** ******
    also the mouse is switching only to vertical and horizontal icons for resizing, when it´s pointed to a corner, it doesn´t properly switch to diagonal resizing icons.

    as an example i made a graphical explanation
    the attachment shows the skinned windows against a sample notepad/windows background
    Attached Images Attached Images
    Last edited by wysota; 27th September 2007 at 21:38.

  18. #17
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default

    i just came with an idea for a theme with thicker borders and no shadow, tell me what you think.

    perhaps a complex task is simulating 3d border frames, the only way i have achieved this was using predefined png bitmaps inserting them in the style of a button but those are usefull for rounded rectangle shapes only.

    see attached

    i´ve just noticed that in the skinned (close, minimize, maximize) window the buttons are not real QButton objetcs.

    they are pixmaps, so they don´t have the same behavior of a button. (change appearance when clicked).

    is it possible to replace those pixmaps with real QButton widgets to add basic button behavior to them? ( i suppose it´s possible because you´re operating inside an invisible frame widget)

    is it possible to create an example that uses a custom made form with form designer?

    how can i pick up an *.ui file and merge it with the skinned window?

    the starting point could be assuming in form designer thet it would have no parent frame.

    i think it could start with a qframe transparent object.

    then, inside this qframe there would be two frames, one for the title bar and its buttons (necessary because this ui form would be set with a framelesswindowhint atribute) and a content frame under the titlebar.

    see this interesting example on how to remove windows titebar and using your own custom made titlebar widget in qt. (it basicaly does the aproach mentioned above)

    "How can I handle events in the titlebar and change its color etc ?"
    http://trolltech.com/developer/knowl...25.2011048382/

    (this example uses real qbutton objects for the titlebar)

    best regards
    Attached Images Attached Images
    Last edited by wysota; 28th September 2007 at 01:09. Reason: Posts merged. Please edit your original post instead of posting again next time

  19. #18
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default

    ok, here it goes

    i´ve just created a test form UI with title bar.

    How can i use this linked to the skin lib? (making the yellow to pink gradient transparent)

    see attached
    (to load correctly the zip files should be created in c:\customform folder)
    (strange bug loading styles)

    ************************************************** **************

    just noticed another inprovement.

    when the maximize button is clicked the application doesn´t really maximizes to the fullest.

    IMO when maximizing the window should have the shadow removed so it can maximize just on the limit of the thin white border with rounded corners.

    ************************************************** **************

    one of the few examples in qt is the shaped clock example.

    in this example qt presents one of it´s weak points, because when it deals with masks, those masks are black and white only. (no alpha mask with the setmask command)

    this results in god finishing inside the application but bad finishing with applications that are different than the "typical" rectangle.

    is it possible to make an example using the lib for the shapedclock where the outer border is antialiased? or maybe even better... showing just the tick marks and the pointers without the grey background.

    see image attached
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by jacek; 28th September 2007 at 13:23. Reason: merged three posts

  20. #19
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned Windows (own TitleBar and Borders)

    okokokok.....
    WOOOOW!
    1. the problem with resizing is because of the shadow. if you don't have any shadow you can even resize at the corners.
    2. you can use all skins you want to they only have to be applied in the skin.dat file.
    3.i don't want to use real buttons, because the user of the class shouldn't have access to them only through the skin.dat file. But the problem with no hover and press actions i will fix.
    4. For picking up a ui File handle it like in normal Widgets. Sublcass QSkinWidget and subclass from your Form :
    Qt Code:
    1. class MyWidget : public QSkinWidget, public Ui::myForm
    To copy to clipboard, switch view to plain text mode 
    5.I think you don't need a designer plugin. You just have to Subclass your form from QSkinWidget instead of QWidget and the skin is applied. wherefore a designer plugin?
    6.maximize is the sam problem with shadow.
    7. For the shaped clock try my Argb-Widget in the Wiki. The skin classes are only for real applications that should have borders.

    PS: pls send me emails^^ it's pain to read all this in the forum....
    markus.kuenkler@gmx.de

  21. #20
    Join Date
    Jul 2011
    Posts
    4
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: Skinned Windows (own TitleBar and Borders)

    Hi
    its Good project
    but Is there a solution with Maximize Application
    The Application Hide The Task Bar ( I dont see The Task Bar )
    Look Img
    Excuse my English is bad

    in minimize.jpg


    in Maximize.jpg

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.