The Ultimate Qt Community site
Home News Forum Wiki Contest FAQ Links

Go Back   Qt Centre Forum > Qt > Qt Programming

Qt Programming General Qt programming issues.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 7th January 2008, 13:40
estanisgeyer estanisgeyer is offline
Intermediate user
 
Join Date: Jan 2008
Qt products used: Qt4
Qt platforms used: Unix/X11 , Windows
Posts: 100
Thanks: 17
Thanked 3 Times in 3 Posts
Exclamation QMdiSubWindow problem with resized window

Hi friends,

I'm developing an application in MDI. I have a window in the designer developed with properties in height and width fixed, but to put in a QMdiSubWindow, these properties are lost and the window can be resized. Indeed there should not appear maximize the button and much less allow resizing. How to fix this?

Here this partial code:

Qt Code:
1
2
3
4
5
6
7
8
9
10
template<class T> T *MainWindow::createT(T *win)
{
    win = new T();
    QMdiSubWindow *mdiSubWin = new QMdiSubWindow;
    mdiSubWin->setWidget(win);
    mdiSubWin->setAttribute(Qt::WA_DeleteOnClose);
    mdiArea->addSubWindow(mdiSubWin);
    mdiSubWin->show();
    // mdiSubWin->setSizePolicy(qobject_cast<T *>(win)->sizePolicy());
}
Thanks help,

Marcelo Estanislau
Standard Net Tecnologia
Brazil - RS

Last edited by jpn; 7th January 2008 at 13:52. Reason: missing [code] tags
Reply With Quote
  #2  
Old 7th January 2008, 14:08
marcel marcel is offline
Expert
 
Join Date: Feb 2006
Location: Romania
Qt products used: Qt4
Qt platforms used: Unix/X11 , Windows
Posts: 2,744
Thanks: 8
Thanked 518 Times in 512 Posts
Default Re: QMdiSubWindow problem with resized window

You have to set the fixed size for the mdiSubWin(which is the container). Even if the child has a fixed size, nobody stops the parent from resizing.

Regards
Reply With Quote
  #3  
Old 7th January 2008, 14:39
estanisgeyer estanisgeyer is offline
Intermediate user
 
Join Date: Jan 2008
Qt products used: Qt4
Qt platforms used: Unix/X11 , Windows
Posts: 100
Thanks: 17
Thanked 3 Times in 3 Posts
Exclamation Re: QMdiSubWindow problem with resized window

Hi again,

Ok, I wrote the code in this function based on the size of my window, see in the picture what happened in attach. This is the code changed:

Qt Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
template<class T> T *MainWindow::createT(T *win)
{
    win = new T();
    QMdiSubWindow *mdiSubWin = new QMdiSubWindow;
    mdiSubWin->setWidget(win);
    mdiSubWin->setAttribute(Qt::WA_DeleteOnClose);
    mdiArea->addSubWindow(mdiSubWin);
    mdiSubWin->show();
    mdiSubWin->setGeometry(0,0,450,300);
    mdiSubWin->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    mdiSubWin->setMinimumSize(450,300);
    mdiSubWin->setMaximumSize(450,300);
    //mdiSubWin->setSizePolicy(qobject_cast<T *>(win)->sizePolicy());
}
We still can maximize the window, giving a double-click the title bar or clicking on the maximize button. Well there might be a resource for the QMdiSubWindow inherit the properties.
Attached Images
File Type: jpg win.jpg (16.6 KB, 14 views)

Last edited by jacek; 7th January 2008 at 15:43. Reason: changed [qtclass] to [code]
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set a window as child at runtime sabeesh Qt Programming 1 26th November 2007 09:30
Problem hiding main window on minimize bpetty Newbie 5 18th September 2007 17:41
New to QT, problem displaying main window... McCall Qt Programming 4 15th June 2007 14:27
Problem in porting Main window on linux jyoti kumar Qt Tools 2 2nd June 2006 08:35


All times are GMT +1. The time now is 00:53.


Powered by vBulletin Version 3.7.4 Copyright ©2000 - 2009, Jelsoft Enterprises Ltd., vRewrite 1.5 SEOed URLs completed by Tech Help Forum and Chalo Na.
© 2006–2009 Qt Centre - The Ultimate Qt Community site
Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.