PDA

View Full Version : custom maximize button---



Naveen
24th February 2006, 14:07
i will take some time to understand this..please have patience...please

i'm collapsing the titlebar by writing the following code in the main....


WId hWnd = w.winId();
long lStyle = GetWindowLong(hWnd, GWL_STYLE);
lStyle &= ~WS_CAPTION;
SetWindowLong(hWnd, GWL_STYLE, lStyle);


and I'm three buttons and setting the pixmap like this

m_Minimize = new CCustomIconButtons(this);
QPixmap minimizePixmap = style()->standardPixmap(QStyle::SP_TitleBarMinButton);
m_Minimize->AddIcons(new QPixmap(minimizePixmap));


restorePixmap = style()->standardPixmap(QStyle::SP_TitleBarNormalButton);

m_Maximize = new CCustomIconButtons(this);
maximizePixmap = style()->standardPixmap(QStyle::SP_TitleBarMaxButton);

m_cbtnMaximize->AddIcons(new QPixmap(restorePixmap));

m_cbtnClose = new CCustomIconButtons(this);
closePixmap = style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
m_cbtnClose->AddIcons(new QPixmap(closePixmap));


and I'm taking a boolean variale maxNormal=true;

I'm having problem only with maximize and Restore button.....


what I'm doing is


void CNavigationBar::on_but_maximize_clicked()
{
if (m_maxNormal)
{
m_maxNormal = !m_maxNormal;
m_Maximize->AddIcons(new QPixmap(maximizePixmap));
parentWidget()->showNormal();


}
else
{
parentWidget()->showMaximized();
m_maxNormal = !m_maxNormal;
m_cbtnMaximize->AddIcons(new QPixmap(restorePixmap));
}
}


If you could understand till here ....Read through to know the problem.....

First when i running the application..

it is first showing me the Maximized window with
1)Minimize button
2)Restore button
3)close Button

and when i click the Restore button the window size is decreasing and the buttons i'm getting is
1)minimize button
2)maximize button(instead of Restore button)
3)close button

now when i again click the maximize button i'm getting back

1)Minimize button
2)Restore button
3)close Button

and when i again maximize this and press the Minimize button ..
it is going to the toolbar and when i left click on it....
it is comming onto the screen and

NOW THE RESTORE AND MAXIMIZE ARE NOT FUNCTIONING PROPERLY


COULD ANYONE HELP



Thanks in Advance

jacek
24th February 2006, 14:11
What does the AddIcons() method do?