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. auto resize widget when mainwindow is resized
Forum Updated to NodeBB v4.3 + New Features

auto resize widget when mainwindow is resized

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.6k 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.
  • N Offline
    N Offline
    nomercy89
    wrote on last edited by
    #1

    Hi all. Using Qt designer, I drew my mainwindow and in a new file, my custom widget.. It's name is "Form" (of corse Form extend QWidget class). In my mainwindow i have a QWidget pattern, it's name is "widgetadd".. and in my mainwindow i have created by code my custom widget using:
    Form * f = new Form(ui->widgetadd);

    MAIN WINDOW
    FORM

    My FORM has a GridLayout and if i try to resize it in designer, all label and QLineEdit resizing.
    The problem is when i run my project, when i resize mainwindow my widget doesnt't resize!
    Could someone help me?

    Result when i run my project:
    PROJECT RUNNING

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Did you insert the widget into the layout ?
      You should add the (form) widget to widgetadd's layout.
      something like
      if (widgetadd->layout())
      widgetadd->layout()->addWidget(f);

      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