Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Persian
  4. بستن فرم
Qt 6.11 is out! See what's new in the release blog

بستن فرم

Scheduled Pinned Locked Moved Persian
4 Posts 3 Posters 2.8k 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.
  • H Offline
    H Offline
    hamedaz
    wrote on last edited by
    #1

    من دوتا فرم دارم فرم دوم را نمایش میدم و میخوام فرم اولم را ببندم این کدها رو نوشتم
    @
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "mydialog.h"

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

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_pushButton_clicked()
    {

        myDialog mdialog;
        mdialog.exec();
    

    }
    @

    @
    #include "mydialog.h"
    #include "ui_mydialog.h"
    #include "mainwindow.h"

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

    MainWindow mainWindow;

    mainWindow.close();
    }

    myDialog::~myDialog()
    {
    delete ui;
    }

    @

    1 Reply Last reply
    0
    • S Offline
      S Offline
      soroush
      wrote on last edited by
      #2

      p{direction: rtl; text-align:right}. اولن MainWindow و myDialog خطای Circular Inclution دارن. حداقل باید یکی‌شو Forward Declare کنی.

      p{direction: rtl; text-align:right}. دوم این که توی سازندهٔ یک کلاس مشتق‌شده از کلاس QWidget یا QMainWindow نمی‌تونی ببندی‌ش.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mohsen
        wrote on last edited by
        #3

        @
        #include "mainwindow.h"
        #include "ui_mainwindow.h"
        #include "mydialog.h"

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

        MainWindow::~MainWindow()
        {
        delete ui;
        }

        void MainWindow::on_pushButton_clicked()
        {
        myDialog *mdialog=new myDialog(); //تبدیل میشه به پوینتر
        mdialog->show();

            this->close(); //فرم خودش رو میبنده
        

        }
        @
        @
        #include "mydialog.h"
        #include "ui_mydialog.h"
        //#include "mainwindow.h" احتیاجی نیست

        myDialog::myDialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::myDialog)
        {
        ui->setupUi(this);
        }
        @

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mohsen
          wrote on last edited by
          #4

          p{direction: rtl; text-align: right}. کدت رو به شکل بالا اصلاح کن

          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