Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Best way to use a QLayout For a QGLWidget which is next to a QToolBox?
Forum Updated to NodeBB v4.3 + New Features

Best way to use a QLayout For a QGLWidget which is next to a QToolBox?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blissfreak
    wrote on last edited by
    #1

    With my current layout, I'm seeing the following:

    !http://i.imgur.com/79rGhRCl.png(Bad Layout)!

    The problem is that I'd like the QToolBox and its nested components to be larger in both height and width. Since the QToolBox encapsulates (currently - there will be more) a single QListView, I'm having some trouble figuring out the best way to do this.

    The ToolBox resides as a component within an InputFrame class, derived from QFrame, and is initialized within the following (inner) block, within the void MainWindow::init( void ) function

    (Note: I haven't set a QLayout for MainWindow - I tried that and Qt complained about there already being a default layout or something)

    @//! Initialize User Input
    {
    mUserInput = new InputFrame( this );

        const int x = width - 400;
        const int y = ( height / 2 ) - 200;
    
        mUserInput->setGeometry( x, y, 300, 300 );
        mUserInput->setFrameShape( QFrame::StyledPanel );
        mUserInput->setFrameShadow( QFrame::Raised );
    

    }@

    When the InputFrame is initialized, the following ensues:

    @void InputFrame::init( void )
    {
    QGridLayout* inputLayout = new QGridLayout( this );
    inputLayout->setObjectName( Layout::fetch( Layout::Input ) );

    mModules = new QToolBox( this );
    
    mGeometry = new QListView( this );
    {
        QStringList strings( Glm::fetch( Glm::Geometry ) );
    
        addFunctionList( mGeometry, "Geometry", strings );
    }
    
    mModules->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Expanding );
    
    inputLayout->setSizeConstraint( QLayout::SetMaximumSize );
    inputLayout->addWidget( mModules );
    

    }

    void InputFrame::addFunctionList( QListView* const& parent, const char* label, const QStringList& funcSigs )
    {
    QItemDelegate* viewDelegate = new QItemDelegate( parent );
    QStringListModel* stringList = new ModuleStringList( parent );

    stringList->setStringList( funcSigs );
    
    parent->setItemDelegate( viewDelegate );
    parent->setModel( stringList );
    parent->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
    
    mModules->addItem( parent, label );
    

    }@

    After experimenting and reading the QLayout documentation - I feel like I'm missing something: the ToolBox is still small.

    I know this has to do with mUserInput->setGeometry(...), yet when I comment that call, the QToolBox and its child widget are thrown into the upper left corner of the screen and extremely small. Naturally I can specify larger dimensions, but if I understand correctly, this will render the layout settings void (i.e., useless given the fact that the ToolBox is hardly displayable at all) - correct?

    Anyway, I appreciate any clarifications/suggestions on this issue; thanks.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved