Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
How to Change close, minimize and maximize icon(urgent)
Hi All,
I am writing application on windows and I want to replace close, minimize and maximize icon of QMainWindow's Title to my own Icon,
And one more thing I want to change the color of title bar as well.
How I can do this.
Please help out it's very urgent for me.
This is one way to do ---->
1.First make the QMainWindow frameless.
2.Then Create Push button with your own icon on the top left of window.
3. When user push that time emit the signal for close, min and max.
But the problem with this approach is I can't move window.
Thanks any suggestion will really helpful.
This post has been edited 2 times, last edit by "junky" (Apr 4th 2009, 12:11pm)
Moving window is not hard task. Something like:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
void mousePressEvent(QMouseEvent *e)
{
if (e->button() != Qt::LeftButton)
return;
m_mousePressPoint = e->pos(); // can be tested whenever it is in required region.
m_canMoveWindow = true; // initialized with false value
}
void mouseMoveEvent(QMouseEvent *e)
{
if ( ! m_canMoveWindow)
return;
move(pos() + e->pos() - m_mousePressPoint);
}
void mouseReleaseEvent(QMouseEvent *e)
{
m_canMoveWindow = false;
}
|
Fighting fire with fire.
Three can keep a secret if two of them are dead.