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 create QFrame on form ui?
Forum Updated to NodeBB v4.3 + New Features

How can I create QFrame on form ui?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 901 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.
  • D Offline
    D Offline
    delio
    wrote on last edited by
    #1

    How can I create QFrame by coding.
    and place it into form ui?

    Thanks

    1 Reply Last reply
    0
    • T Offline
      T Offline
      topix93
      wrote on last edited by
      #2

      @
      #include "MainWindow.h"
      #include "ui_MainWindow.h"
      #include <QLayout>

      MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
      {
      ui->setupUi(this);

      QFrame *mFrame = new QFrame(this);
      mFrame->setGeometry(50, 50, 100, 100);
      mFrame->setStyleSheet("background-color:black;");
      
      this->layout()->addWidget(mFrame);
      

      }
      @

      1 Reply Last reply
      0
      • D Offline
        D Offline
        delio
        wrote on last edited by
        #3

        If I want to refer it in main.cpp not mainwindow.cpp
        how can I do?

        Thanks for answer

        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