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. [SOLVED] Popup window when app is executed
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Popup window when app is executed

Scheduled Pinned Locked Moved General and Desktop
4 Posts 1 Posters 2.2k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello, I am doing Music player and Video player... What I would like to do is when user starts application it would show a window with two buttons-> Music player or Video Player... So if user clicks on MP it should execute Music Player window and if user clicks VP it should execute Video Player window...

    So should I use MainWindow as first app window which will have two buttons, or should I create widget that will popup when app.exe is executed??? How can I execute MP or VP class from a button (each of them would have its own UI and class)

    Also is it possible to use QML and normal Widget together??? If user clicks on MP it should execute normal Widget, but if clicks VP it should execute QML code (since QML it has more effects)...

    Something like that... Later on I would add "Return button" at MP and VP window, so it would return back to First Window
    !http://img822.imageshack.us/img822/5596/bkf2.png(hmm)!

    Or I should create three standalone apps and then just execute MP app or VP app from First window??? Though I would rather see it as one app...

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hello, I made a popup window, but don't know how to execute class "mplayer" and its UI when "connectButton" is clicked...

      @#include "mainwindow.h"
      #include <QApplication>
      #include "mplayer.h"
      #include <QMessageBox>
      #include <QPushButton>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);

      QMessageBox msgBox;
      QPushButton *connectButton = msgBox.addButton(QObject::tr("Connect"), QMessageBox::YesRole);
      QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);

      if (msgBox.clickedButton() == connectButton) {

      }
      else if (msgBox.clickedButton() == abortButton) {
      // abort
      }
      msgBox.exec();
      return a.exec();
      }
      @

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Hello again... I've created a dialog which works fine and also executes widgets I want... But I can't get it work with custom buttons... I can use only QDialog::Accepted or Rejected... So my code below -> when Accepted is clicked Widget m will open if Reject or X button is clicked T1 t will open...
        I would like to set it twice -> Apply or Ok button and X to be close button... And change name of buttons... Which I have no idea how...

        @int main(int argc, char *argv[])
        {
        QApplication a(argc, argv);

        Dialog log(0);
        if (log.exec&#40;&#41; == QDialog::Accepted) {
             Widget m;
             m.show();
             a.exec&#40;&#41;;
           } else  {
             T1 t;
             t.show();
             a.exec&#40;&#41;;
         }
        
         return 0;
        

        }
        @

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          SOLVED!

          @QMessageBox newmb;
          QPushButton *connectButton = newmb.addButton(QDialog::tr("Connect"), QMessageBox::ActionRole);
          QPushButton *connectButton2 = newmb.addButton(QDialog::tr("Connect2"), QMessageBox::ActionRole);
          newmb.setText("That");
          newmb.exec();
          if(newmb.clickedButton() == connectButton)
          {
          Widget m;
          m.show();
          a.exec();
          }
          else if(newmb.clickedButton() == connectButton2)
          {
          T1 t;
          t.show();
          a.exec();
          }
          @

          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