Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] how to link a form(.ui) to another form using push button
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] how to link a form(.ui) to another form using push button

Scheduled Pinned Locked Moved Qt Creator and other tools
24 Posts 3 Posters 20.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.
  • Y Offline
    Y Offline
    yola-yoli
    wrote on last edited by
    #15

    okey, thanks all...
    i will learn it...

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yola-yoli
      wrote on last edited by
      #16

      @cdeepak : i want ask about parent child concept...
      i have two form,
      form 1 is main menu and form 2 is sub menu...
      i want create a button in form 2, the button used to back in form1,
      i use the ame way but failed...
      can you help me?

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #17

        Hi,
        i am searching the sample mdi parent chid project in my pc wait for while

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #18

          you can use QWorkspace for that

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #19

            Hi,
            here i have used menubar instead of QPushbutton so u try to understand the concept and do it in your own way.....
            mdiwindow.cpp

            @#include "mdiwindow.h"
            #include "ui_mdiwindow.h"
            #include <QMessageBox>
            #include <QVariant>
            #include <QString>
            MDIWindow::MDIWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MDIWindow)
            { ui->setupUi(this);
            workspace = new QWorkspace;
            setCentralWidget(workspace);

            connect(ui->actionChild1,SIGNAL(triggered()),this,SLOT(OpenChild1()));
            connect(ui->actionChild2,SIGNAL(triggered()),this,SLOT(OpenChild2()));
            //connect(&cw1,SIGNAL(ChildWindow1Closed()),this,SLOT(StatusUpdate()));
            

            connect(ui->actionChild_window_status,SIGNAL(triggered()),SLOT(ChildStatus()));
            connect(ui->actionActivated_Window,SIGNAL(triggered()),SLOT(FindActivatedWindow()));
            connect(ui->actionChild_Window_Count,SIGNAL(triggered()),SLOT(FindChildCount()));

            }

            MDIWindow::~MDIWindow()
            {
            delete ui;
            }
            void MDIWindow::FindChildCount()
            {
            //Type Conversion from int to string
            int a =workspace->windowList().count();
            QString str;
            str=QVariant(a).toString();
            str=QString::number(a,16);
            statusBar()->showMessage("Child Window Count is" + str );
            }
            void MDIWindow::StatusUpdate()
            {

            }
            void MDIWindow::FindActivatedWindow()
            {
            if(!workspace->windowList().isEmpty())
            statusBar()->showMessage(workspace->activeWindow()->windowTitle() + " is Activated Now " );
            else
            statusBar()->showMessage("No Active Child Window");
            }
            void MDIWindow::ChildStatus()
            {
            if(workspace->windowList().isEmpty())
            {
            statusBar()->showMessage(" No Child Window Opened");
            }
            else
            {
            statusBar()->showMessage("Child Window Opened");
            }
            }
            void MDIWindow::OpenChild1()
            {
            if(!ObjChild1->isVisible())
            {
            ObjChild1 = new ChildWindow1;
            }
            workspace->addWindow(ObjChild1);
            ObjChild1->setWindowTitle("Child1");
            ObjChild1->show();
            statusBar()->showMessage(workspace->activeWindow()->windowTitle() + " Opened Just Now");
            }
            void MDIWindow::OpenChild2()
            {
            if(!ObjChild2->isVisible())
            {
            ObjChild2 = new ChildWindow2;
            }
            workspace->addWindow(ObjChild2);
            ObjChild2->setWindowTitle("Child2");
            ObjChild2->show();
            //statusBar()->showMessage("Child Window opened");
            statusBar()->showMessage(workspace->activeWindow()->windowTitle() + " Opened Just Now");
            }
            @

            mdiwindow.h

            @#ifndef MDIWINDOW_H
            #define MDIWINDOW_H

            #include <QMainWindow>
            #include "childwindow1.h"
            #include "childwindow2.h"
            #include <QWorkspace>

            namespace Ui {
            class MDIWindow;
            }

            class MDIWindow : public QMainWindow
            {
            Q_OBJECT

            public:
            explicit MDIWindow(QWidget *parent = 0);
            ~MDIWindow();

            //ChildWindow1 cw1;
            private slots:
            void OpenChild1();
            void OpenChild2();
            void ChildStatus();
            void FindActivatedWindow();
            void FindChildCount();
            public slots:
            void StatusUpdate();

            private:
            Ui::MDIWindow ui;
            QWorkspace workspace;
            ChildWindow1
            ObjChild1;
            ChildWindow2
            ObjChild2;
            };

            #endif // MDIWINDOW_H
            @

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #20

              [quote author="cdeepak" date="1329371126"]you can use QWorkspace for that
              [/quote]

              QWorkspace is deprecated!

              Please use [[Doc:QMdiArea]] and [[Doc:QMdiSubWindow]].

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • Y Offline
                Y Offline
                yola-yoli
                wrote on last edited by
                #21

                @cdeepak : i try to rewrite your source, when i run it, it doesn't work...
                i don't know why...

                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  yola-yoli
                  wrote on last edited by
                  #22

                  @cdeepak:
                  i know the problem,
                  i write the source using Qt Mobile, but you using Qt Gui,right?
                  now, i'm making an application for symbian mobile...

                  1 Reply Last reply
                  0
                  • Y Offline
                    Y Offline
                    yola-yoli
                    wrote on last edited by
                    #23

                    @volker : can you help me to solve my problem?
                    i'm making an application for symbian mobile using Qt Mobile, not Qt GUI

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #24

                      Sorry, I don't have experience with mobile development.

                      From a simple point of view, neither QWorkspace nor QMdiArea seem to be appropriate widgets for mobile devices. These are pure desktop widgets, in my opinion.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      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