Re: Disable resize events
Hi myrky!
To use a fixed size window, you have to set the minimum and maximum size of the window to the same size, and set size policy to fixed. This can either be done from QtDesigner or from code. For example to limit the size of your window to 300x300:
Code:
QSize fixedSize
(300,
300);
setMinimumSize(fixedSize);
setMaximumSize(fixedSize);
To disable resize events, you have to reimplement the resizeEvent virtual function in your subclass of QWidget and ignore the resize event... , but I think it's the previous solution is what you're looking for.
Re: Disable resize events
Quote:
Originally Posted by
myrky
When i load a website who ask a resize of mainwindow my flash interface is rezised to a small value and i dont want a resize.
Can you elaborate on what you mean by the website wanting to resize your main window?
Re: Disable resize events
Quote:
Originally Posted by
wysota
Can you elaborate on what you mean by the website wanting to resize your main window?
Ok, when i open a url i lauch an application from it and this application resize my main windows (my flash interface). But i disabled it using this
Code:
QSize fixedSize
(1920,
1200);
setMinimumSize(fixedSize);
setMaximumSize(fixedSize);
The application resize my main window instead. I dont know how to prevent it.
Re: Disable resize events
No offense, but to be honest myrky I don't understand your problem exactly either. Some samples from your code and some screenshots would be useful.
Re: Disable resize events
My problem is when my application is in fullscreen mode my mainwindow can be resized by another application. If it not in fullscreen this work good.
Re: Disable resize events
What other application? What does WebKit has to do with it?
Re: Disable resize events
I use webkit in my application, when i open a website there is javascript who resize my mainwindow. Here the javascript :
Code:
<script language="javascript">
function SetWindowSize(w,h) {
var screenH = screen.height;
var screenW = screen.width;
if (window.navigator.appName=="Netscape") {
if (window.navigator.userAgent.indexOf("Firefox") != -1) {
window.resizeTo(w,h - 90);
} else if(window.navigator.userAgent.indexOf("Netscape") != -1) {
window.resizeTo(w,h - 112);
} else {
window.resizeTo(w,h - 112);
}
} else {
window.resizeTo(w,h - 112);
}
window.moveTo((screenW-w)/2,(screenH-h)/2);
}
</script>
<SCRIPT LANGUAGE = "JavaScript">
var dom = document.getElementById?1:0;
var NS4 = (document.layers && !dom )? 1:0;
// do for ns4 resize problem
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if (false) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
if(NS4)
MM_reloadPage(true);
</SCRIPT>
I can setup my windows to avoid resizing if my application is not in full screen by using that code :
Code:
QSize fixedSize
(1920,
1200);
setMinimumSize(fixedSize);
setMaximumSize(fixedSize);
But this don't work in fullscreen mode.
I want to disable resizing from that javascript.