Resizing widget in a gridlayout



  • Ok this may be a stupid question, but I cannot seem to be able to change the size of a widget in a given layout. When i set the max and min height and width it has no affect to what is drawn.

    here is some code:

    // the function that actually creates a txtbox
    @QTextEdit* TextBoxFactory::createTxtBox_GenericLargeTxtBox(const int &height, const int &width,const QString &id,const QString &styleSheet)
    {

    QTextEdit *text = new QTextEdit;
    
    QString *instanceStringLarge = new QString;
    
    text->setMaximumHeight(height);
    
    text->setMinimumHeight(height);
    
    text->setMaximumWidth(width);
    
    text->setMinimumWidth(width);
    
    text->selectAll();
    
    text->setStyleSheet(styleSheet);
    
    text->setObjectName(id+"_"+instanceStringLarge->setNum((TextBoxFactory::nextInstance)));
    
    
    
    TextBoxFactory::nextInstanceLarge++;
    
    
    
    return text;
    

    }
    @

    the function call that creates it:

    @ gridLayout->addWidget(TextBoxFactory::GetInstance()->createTxtBox_GenericLargeTxtBox(19,50,"txt_Medication_Dosage",NULL),
    3,1,Qt::AlignLeft | Qt::AlignBottom);@

    no matter what i try, the widget simply fills the size of the row.

    is there a way to keep this from happening. I basically want to have two widgets reside within the same row without overlapping each other.
    thanks



  • NeverMind, I figured it out( fyi the code above is not the function to which i was having issue, i posted the wrong one)


Log in to reply
 

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