[SOLVED] Popup window when app is executed



  • 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...



  • 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();
    }
    @



  • 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;
    

    }
    @



  • 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();
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.