Results 1 to 17 of 17

Thread: making an application window non resizable

  1. #1
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question making an application window non resizable

    I have a QDialog that i would like to make non resisable...

    how can i do it?

    N.A

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: making an application window non resizable

    Qt Code:
    1. dialog->layout()->setSizeConstraint(QLayout::SetFixedSize);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    Use either setFixedSize( sizeHint() ), or ( better ) QLayout::setSizeConstraint( QLayout::SetFixedSize ).

    The later will allow resizing if system dimensions change ( font sizes, etc ).
    But to use it, your layout design must have no errors.

    Regards

  4. #4
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    what is the name of the layout?? i take the gui from qt designer, i have a grid layout.What is it's name?

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    It does not have a name.
    You can access it via the layout() function, as jpn said.

  6. #6
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    Quote Originally Posted by jpn View Post
    Qt Code:
    1. dialog->layout()->setSizeConstraint(QLayout::SetFixedSize);
    To copy to clipboard, switch view to plain text mode 
    if write this, i get this error "expected primary expression before '->' token


    any ideas?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: making an application window non resizable

    Substitute "dialog" with your variable containing a pointer to the dialog in question. And next time please use the search facilities before asking questions which you suspect may have already been answered.

  8. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    You can call this from the constructor of your dialog:
    Qt Code:
    1. layout()->setSizeConstraint( QLayout::SetFixedSize );
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    Quote Originally Posted by marcel View Post
    You can call this from the constructor of your dialog:
    Qt Code:
    1. layout()->setSizeConstraint( QLayout::SetFixedSize );
    To copy to clipboard, switch view to plain text mode 
    the problem is that with this option, it compiles and then when i try to run it it throws a runtime exception

  10. #10
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: making an application window non resizable

    Sounds like layout() returns 0, which means you haven't installed a top level layout on the dialog. If you're using Designer, deselect all the child widgets, open up context menu over the background of the dialog form, select "Layout->...". In another words, a layout dragged from the widget box is not installed on the dialog but is a "floating layout".
    J-P Nurmi

  11. #11
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    What is the exception?
    This most likely is because your layout design is not correct.
    Do you have a layout set in your dialog at all?
    What about setFixedSize( sizeHint() )?

    Could you post some relevant code?

  12. #12
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    Quote Originally Posted by marcel View Post
    What is the exception?
    This most likely is because your layout design is not correct.
    Do you have a layout set in your dialog at all?
    What about setFixedSize( sizeHint() )?

    Could you post some relevant code?
    error 400 run time exception. I have done my layout design with qdesigner....how can it be wrong?

    which part you want posted?

    Qt Code:
    1. ippalosGui::ippalosGui(QWidget* parent):QDialog(parent),ippalos()
    2. {
    3. setupUi(this);
    4. heapSort_RadioButton->setChecked(true);
    5. sortingOptionsGroupBox->setVisible(false);
    6. processButton->setEnabled(false);
    7.  
    8.  
    9. //sortingOptionsGroupBox->hide();
    10. //settingsGroupBox->hide();
    11. settingsPushButton->setChecked(false);
    12. //layout()->setSizeConstraint(QLayout::SetFixedSize); //making the dialog non-resizable by the user
    13.  
    14.  
    15.  
    16.  
    17.  
    18. createActions();
    19. createMenu();
    20. //lineEditEditedText->setText("Constructor...");
    21.  
    22.  
    23. //all connects happen inside the cnstuctor...
    24.  
    25. //connect radio buttons... toggled()
    26. connect(measureButton, SIGNAL(clicked()), this, SLOT(doTakeMeasurements()));
    27. //connect(processButton, SIGNAL(clicked()), processButton, SLOT(showMenu()));
    28. connect(aboutButton, SIGNAL(clicked()), this, SLOT(about()));
    29.  
    30. }
    To copy to clipboard, switch view to plain text mode 

  13. #13
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    this is y ui file...
    Attached Files Attached Files

  14. #14
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    If you'd post the UI it would be better.
    Also, where do you call layout()->setSizeConstraint?

  15. #15
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    OK.
    You didn't set a top level layout as jpn said. That is why it gave you the exception.
    Try the one I attached.

    regards
    Attached Files Attached Files

  16. The following user says thank you to marcel for this useful post:

    aegis (13th May 2007)

  17. #16
    Join Date
    Feb 2007
    Posts
    42
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    Quote Originally Posted by marcel View Post
    OK.
    You didn't set a top level layout as jpn said. That is why it gave you the exception.
    Try the one I attached.

    regards
    thanks for your reply. You saved me cause i have to deliver by tomorow... but i have some more general questions that i want to ask you!

  18. #17
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: making an application window non resizable

    Go ahead and post them...
    If not me, I'm sure the guys will be able to answer.

    Regards

Similar Threads

  1. accessing my main application window widget
    By jayw710 in forum Newbie
    Replies: 8
    Last Post: 15th November 2007, 19:33
  2. Replies: 6
    Last Post: 3rd May 2007, 15:17
  3. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07
  4. Making some part of window transparent
    By yogeshm02 in forum Qt Programming
    Replies: 1
    Last Post: 27th March 2006, 20:36
  5. Replies: 0
    Last Post: 21st February 2006, 16:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.