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. Resizing widget in a gridlayout
Forum Updated to NodeBB v4.3 + New Features

Resizing widget in a gridlayout

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.9k 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.
  • W Offline
    W Offline
    webmaster.skelton
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • W Offline
      W Offline
      webmaster.skelton
      wrote on last edited by
      #2

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

      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