Designing in QtCreator.



  • Hi,

    I am developing an application having a main form(ui) which has many groups, tabs, buttons, labels, etc.
    While editing/designing a widget I have to reduce the size of all other widgets(groups, tabs, buttons, labels, etc.).
    My problem is when all the widgets are at their desired size it creates a lot of confusion and can't edit/design the required widget.
    So my question is how can I hide all other widgets automatically while editing/designing a particular widget.



  • I'm not entirely sure I understand what you mean. Do you mean that your main window doesn't fit onto your screen or is it simply too big an issue trying to manage all the elements of your main window?

    If your problem is the former, you may have to re-design and move some of the functionality to separate forms that will be shown when the user triggers a specific action (if it doesn't fit on your monitor, it probably won't fit on your user's either).

    If the problem is the latter, perhaps you should consider creating separate custom widgets, each with their own designer form, that you can add to your main widget to create your main window.



  • When your UI gets too cramped a good solution is to use the "outliner" the window on top of the properties on the left that shows a tree of all UI elements, you can use it to select elements as well as to drag and drop elements onto other elements like you do in the UI editor.

    I wouldn't recommend organizing different panels into separate widgets because that will make accessing different UI elements harder, you have to create a bunch of extra signals and slots and such. There is absolutely no point in doing so unless you plan to reuse those "panels" - if not, it just adds inconvenience, more typing, more connections. Do not make modular something you don't need to be a module, and you can still access every item through the ui pointer directly.



  • Hi,

    Thanks for your reply.
    Actually my main window consists of many UI elements.
    So while designing I am unable to locate that element which I want to edit/design/modify as there are many elements on top of each other.
    What I want to know is while editing a particular element is there any way that can hide all other elements?



  • [quote author="Ketan Shah" date="1358329825"]Hi,
    Thanks for your reply.
    Actually my main window consists of many UI elements.
    So while designing I am unable to locate that element which I want to edit/design/modify as there are many elements on top of each other.[/quote]

    Could you post a screenshot of what you mean? I find it hard to visualise your problem.

    [quote author="Ketan Shah" date="1358329825"]What I want to know is while editing a particular element is there any way that can hide all other elements?[/quote]

    Not as far as I know...



  • Hello!

    I think you can do it with "foreach":http://doc.qt.digia.com/qt/containers.html#the-foreach-keyword, looking for all widgets except the current one, and calling ->hide() on every other. Maybe something like

    @foreach (QWidget *widget, QApplication::topLevelWidgets())
    {
    if (!wigdet->hasFocus())
    widget->hide();
    }@

    Hope it helps.

    Regards



  • Mmmm sorry, you want to do it before execution? I agree with goblincoding, the most similar thing to that is to disable every widget, but they aren't hidden.



  • !http://s13.postimage.org/4mrrvmjxz/test.pnghttp://(Test)!

    I have uploaded the screenshot of my Ui file, please check it.
    The Ui file consists of 3 groupboxes, each groupbox contains some elements.
    The problem is when I want to modify/redesign GroupBox1, I am not able to see it.
    So my question is how can I hide GroupBox and GroupBox2, when I want to redesign GroupBox1? The same goes for other elements too.
    Hope now my question is clear.



  • OK, now it all makes sense. Your problem is that you aren't making use of Qt's layout system. Have a look at the "widgets and layouts":https://qt-project.org/doc/qt-4.8/widgets-and-layouts.html documentation and pay special attention to "layout management":https://qt-project.org/doc/qt-4.8/layout.html

    That should help you solve your problem :)

    EDIT: If you really want to have widgets "on top of each other", have a look at "QStackedWidget":https://qt-project.org/doc/qt-4.8/qstackedwidget.html





  • Hi,

    Thanks @goblincoding and @pke62 for your replies. It worked.
    But now I have one more problem while using QStackedWidget.
    How can I hide the borders of QStackedWidget that appears on all the four sides of it?



  • If I understand you correctly, it sounds as if you still aren't using layouts correctly, please see "this previous post":https://qt-project.org/forums/viewthread/23776/#110704 for links to more information.



  • [quote author="goblincoding" date="1358514448"] If you really want to have widgets "on top of each other", have a look at "QStackedWidget":https://qt-project.org/doc/qt-4.8/qstackedwidget.html[/quote]

    In the documentation for QStackedWidget referenced above by goblincoding, look for:

    setFrameShadow ( Shadow )
    setFrameShape ( Shape )
    setFrameStyle ( int )


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.