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. How can i use Widget from Qt designer to add a QWidget inside of it from the code
QtWS25 Last Chance

How can i use Widget from Qt designer to add a QWidget inside of it from the code

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 499 Views
  • 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.
  • A Offline
    A Offline
    adampeter
    wrote on last edited by
    #1

    alt text

    QWidget *widget = new QWidget();
    QGridLayout *layout = new QGridLayout(widget);
    widget->setLayout(layout);
    layout->addWidget(new QPushButton("My Button", widget));
    

    How can i add widget inside a Widget from qt designer

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

      Hi
      Any widget you add in the designer is accessible via
      ui->widgetname

      So if you place your code after setupUI in constructor then
      you can just use it like any normal pointer that you new'd yourself

      1 Reply Last reply
      2

      • Login

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