View Full Version : overriding the minimise,maximise buttons
amulya
21st March 2006, 06:56
hi all,
Could anyone please tell me if we r able to override the minimise,maximise and close buttons with our own images....i believe its possible...but couldnt find any way to do it....any help would be highly appreciated.
Thanks for ur time
Cheers,
Amulya
jpn
21st March 2006, 07:06
Implement your own style and override standardPixmap() (http://doc.trolltech.com/4.1/qstyle.html#standardPixmap).
amulya
21st March 2006, 07:33
hi jpn,
thanx for a fast reply...although i couldnt find a particular function using which i could directly target the minimise,maximise and close buttons...i do hope u could help me on that.
Thanx
Cheers,
Amulya
amulya
24th March 2006, 06:46
hi jpn,
i think i phrased my reply wrongly..i wanted to ask how should i include my images or where should i provide them...like..in StandardPixmap function...the StandardPixmap could be either minimise,maximise or close button...that i understand..but which styleoption should i use....if StyleOptionTitleBar then it doesnt have any function using which i can provide the relevant image....please help me out on that..i m really confused on how to implement it
Thanx for ur time
Cheers,
Amulya
jpn
24th March 2006, 09:05
I believe I will have to eat my words.. Seems you can't customize the title bar with styles, since the title bar is out of Qt's scope. You may give hints (http://doc.trolltech.com/4.1/qwidget.html#windowFlags-prop) which buttons you want to appear, but for the way you want it to be customized, you may need to hide the original title bar (Qt::FramelessWindowHint) and draw your own customized title bar by yourself. There is a whole lot of code needed to handle movement and resizing, though..
high_flyer
24th March 2006, 09:22
http://www.qtcentre.org/forum/showthread.php?t=1123&highlight=font
amulya
24th March 2006, 09:25
hi jpn,
thanx for replying...i was though wondering if the following would work
QPixmap standardPixmap ( StandardPixmap standardPixmap, const QStyleOption * option = 0, const QWidget * widget = 0 ) const
{
QPixmap maximiseImage(":/images/woodbackground.png");
QPixmap minimiseImage(":/images/woodbutton.png");
QPixmap closeImage(":/images/woodbackground.png");
QPixmap contextHelpImage(":/images/woodbutton.png");
switch(standardpixmap){
case SP_TitleBarMinButton:
return minimiseImage;
case SP_TitleBarMaxButton:
return maximiseImage;
case SP_TitleBarCloseButton:
return closeImage;
case SP_TitleBarContextHelpButton:
return contextHelpImage;
}
}
if standardpixmap() works .... this should solve my problem....please give me ur suggestions.
Thanx for ur time.
Cheers,
Amulya
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.