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]How can I launch a QWizardPage with a key?
QtWS25 Last Chance

[Solved]How can I launch a QWizardPage with a key?

Scheduled Pinned Locked Moved General and Desktop
qwizardqwizardpagekeys
38 Posts 3 Posters 10.9k 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.
  • R Offline
    R Offline
    roseicollis
    wrote on 18 Feb 2016, 14:41 last edited by roseicollis
    #29

    @kshegunov said:

    As far as I can tell, the one you quoted is a perfectly valid English expression.

    Ok.. as you said it was something spanish I thought that thas a bad-literal translation...

    It sounds silly, but did you update your HW program with the last one (with the last code)?

    Yes it might seem silly but it isn't.. so many problems came from here but in this case it is silly because as I've got a lot of problems (releases that doesn't update well.. and so on), what I do every time is deleting the old release and then generate the new one and also I always check the date and time of the file...

    I forgot to add on my last post that I also tried with that:

    yesButton->setFocus();
    yesButton->setFocusPolicy(Qt::TabFocus);
    

    And I've tried with your last lines and still its the same... the focus is stuck in the PB1... u.u'' I'm trying everything I think but nothing.... what a problem (I ran out of time and all those little gnomes/mushrooms/code strange problems doesn't help me so much) xD

    Don't use QString::fromUtf8 like you're doing, what you had before (tr("some text")) was perfectly fine.

    Which is the difference between "text" and tr("text") ? In my case I have to use QString::fromUtf8 because its the only way I can use accents in my text and ofc my app is in spanish... I just switch it to english to post it here so it will be more understandable to everyone who reads this topic :) So my code its something like QString::fromUtf8("Confirmación");

    Kind regards for you too!! :D hehe

    K 1 Reply Last reply 18 Feb 2016, 15:09
    0
    • R roseicollis
      18 Feb 2016, 14:41

      @kshegunov said:

      As far as I can tell, the one you quoted is a perfectly valid English expression.

      Ok.. as you said it was something spanish I thought that thas a bad-literal translation...

      It sounds silly, but did you update your HW program with the last one (with the last code)?

      Yes it might seem silly but it isn't.. so many problems came from here but in this case it is silly because as I've got a lot of problems (releases that doesn't update well.. and so on), what I do every time is deleting the old release and then generate the new one and also I always check the date and time of the file...

      I forgot to add on my last post that I also tried with that:

      yesButton->setFocus();
      yesButton->setFocusPolicy(Qt::TabFocus);
      

      And I've tried with your last lines and still its the same... the focus is stuck in the PB1... u.u'' I'm trying everything I think but nothing.... what a problem (I ran out of time and all those little gnomes/mushrooms/code strange problems doesn't help me so much) xD

      Don't use QString::fromUtf8 like you're doing, what you had before (tr("some text")) was perfectly fine.

      Which is the difference between "text" and tr("text") ? In my case I have to use QString::fromUtf8 because its the only way I can use accents in my text and ofc my app is in spanish... I just switch it to english to post it here so it will be more understandable to everyone who reads this topic :) So my code its something like QString::fromUtf8("Confirmación");

      Kind regards for you too!! :D hehe

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 18 Feb 2016, 15:09 last edited by kshegunov
      #30

      @roseicollis

      Also you could try setting a parent to the message box (substitute NULL for this in the constructor) and see if that works better (it won't be able to leave the main window area, but hopefully this won't be a problem).

      What about this? I'm really running out, or more correctly have run out, of ideas ...

      Which is the difference between "text" and tr("text") ?

      "text" is of type const char * const - a string literal, while tr("text") takes the string "text" and looks it up into the translation tables to create a QString from it that's translated to the currently set language. However, your next explanation seems like a valid reason to use QString::fromUtf8 instead, since you don't appear to be using the translation framework.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        roseicollis
        wrote on 18 Feb 2016, 15:25 last edited by roseicollis
        #31

        @kshegunov said:

        try setting a parent to the message box

        Sorry didn't saw it. Tried and its the same, the only thing that changes is that, as the default text is red in the parent, the QMessageBox's text is red too. but still the samebehaviour with PB1 focused... the QMessage appears like if you put a stick there....

        I'm really running out, or more correctly have run out, of ideas ...

        Wow! I thought that would never be possible!! :D Haha you had a lot of different ideas :D My next thought is: how could I do this confirm message without using QMessagebox or QDialog (I still dunno why do you call it "modal").. I'm trying to think how to do it if those classes didn't exist.. but not sure about the options...

        "text" is of type const char * const - a string literal, while tr("text") takes the string "text" and looks it up into the translation tables to create a QString from it that's translated to the currently set language.

        I think I understand you but do you know any clear example? I think that you mean that if it has to change any letter it will o it but not sure

        However, your next explanation seems like a valid reason to use QString::fromUtf8 instead, since you don't appear to be using the translation framework.

        Are you sure? Oh wow I did something fine! hahahaha (I'm trying to be positive xd)

        Note: I've tried also with:

        box.setFocus();
        box.setFocusPolicy(Qt::PopupFocusReason);
        

        ofc nothing works...

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 18 Feb 2016, 15:58 last edited by
          #32

          @roseicollis

          My next thought is: how could I do this confirm message without using QMessagebox or QDialog (I still dunno why do you call it "modal").. I'm trying to think how to do it if those classes didn't exist.. but not sure about the options...

          Because they are modal, i.e. they don't allow the user to interact with other windows from your application. Modeless dialogs on the other hand can lose the focus and the user can interact with other widgets.

          On your second question:
          You could use a generic widget, however I really doubt that anything will change. Something like this:

          QWidget * dialogWidget = new QWidget(this);
          dialogWidget->setAttribute(Qt::WA_DeleteOnClose, true);  //< Takes care to delete the widget when it's closed.
          dialogWidget->setWindowModality(Qt::WindowModal);      //< Makes the widget modal
          
          // Initialize with a form:
          Ui::MessageFormUi dwUi;
          dwUi.setupUi(dialogWidget);
          
          // Connect buttons as appropriate here ...
          
          // And finally, show the widget
          dialogWidget->show();
          

          I think I understand you but do you know any clear example? I think that you mean that if it has to change any letter it will o it but not sure

          No I don't have an example on hand, you could try the translation framework's documentation, it should be explained there.

          Kind regards.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            roseicollis
            wrote on 18 Feb 2016, 16:00 last edited by roseicollis
            #33

            @kshegunov I've see something curious...maybe it helps or enlight someone... As I said the program is going to run only with keyboard but I can connect a mouse on my tests so I did it to see what happened. If I mouseover the Yes/No buttons they get the focus and if I click on them they do what they have to do....

            What I can't understand is why:

            • in the Pc you see: the program normal > press Esc > then it appears more obscured like with fog so you see clearly the QMessageBox and center your vision on it and the focus dissapears from PB1 to the Yes button
            • in the HW: the program normal > press Esc> then ... it appears as a moment before, with the PB1 focused, not obscured, no changes... but with the QMessageBox in the middle like a stick and like if the program where frozen (but it isn't as I can use mouse and click on Yes/no buttons).

            I'll try now your example with a widget and tell you something as soon as possible :)

            No I don't have an example on hand, you could try the translation framework's documentation, it should be explained there.

            Ok don't worry I'll search it later :D

            Thank you!

            EDIT:

            1. My mate told me that there is no window manager in the HW (this is one of the dlls they took off....) so maybe this is the problem.. but I still have to find a solution to my problem...
              I've tried using box.grabKeyboard(); with QMessageBox and guess what? Still the same behaviour .. BUT if you press Y (of Yes) it closes the program and if you press N (of No) it closes the QMessageBox... Its something but its really ugly and not a final solution as there is no focus on the buttons and the users can't guess that (Even if I write something as: Do you want to quit? Press Y if yes, N if don't"

            2. About your widget solution... I must be missing something because it does not show up.... I did add new>qt form>QWidget>named it MessageFormUi.ui >runqmake> added #include "ui_MessageFormUi.h" but then I can't use the Ui::MessageFormUi *ui; I had to use Ui::Form *ui ... I couldn0t use MessageFormUi... I copy the code snippet.. its just the same as yours but it doesn't show up (connections will come later if it is shown on screen)

                    QWidget * dialogWidget = new QWidget(this);
                    dialogWidget->setAttribute(Qt::WA_DeleteOnClose, true);  //< Takes care to delete the widget when it's closed.
                    dialogWidget->setWindowModality(Qt::WindowModal);      //< Makes the widget modal
            
                    // Initialize with a form:
                    Ui::Form dwUi;
                    dwUi.setupUi(dialogWidget);
            
                    // Connect buttons as appropriate here ...
            
                    dialogWidget->show();
            

            Thanks and regads!

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 18 Feb 2016, 20:25 last edited by
              #34

              You should use a QDialog if you expect your widget to act as dialog.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • R Offline
                R Offline
                roseicollis
                wrote on 19 Feb 2016, 08:32 last edited by
                #35

                @SGaist said:

                You should use a QDialog if you expect your widget to act as dialog.

                Hi Sgaist, thanks for your reply. I tried it too with the next code:

                QDialog dialog(this, Qt::Dialog | Qt::CustomizeWindowHint);
                Ui::Dialog ui;
                ui.setupUi(&dialog);
                int result = dialog.exec();
                if (result == QDialog::Accepted)
                    close();
                

                And it shows up BUT I'm still having the same problem... in the HW the focus is not passed from WP to this dialog and I can't focus the Yes/No buttons...

                K 1 Reply Last reply 19 Feb 2016, 12:05
                0
                • R roseicollis
                  19 Feb 2016, 08:32

                  @SGaist said:

                  You should use a QDialog if you expect your widget to act as dialog.

                  Hi Sgaist, thanks for your reply. I tried it too with the next code:

                  QDialog dialog(this, Qt::Dialog | Qt::CustomizeWindowHint);
                  Ui::Dialog ui;
                  ui.setupUi(&dialog);
                  int result = dialog.exec();
                  if (result == QDialog::Accepted)
                      close();
                  

                  And it shows up BUT I'm still having the same problem... in the HW the focus is not passed from WP to this dialog and I can't focus the Yes/No buttons...

                  K Offline
                  K Offline
                  kshegunov
                  Moderators
                  wrote on 19 Feb 2016, 12:05 last edited by
                  #36

                  @roseicollis

                  My mate told me that there is no window manager in the HW

                  I'm really doubtful of this, I believe your mate is feeding you misinformation.

                  but I still have to find a solution to my problem...

                  It might be impossible.

                  About your widget solution... I must be missing something because it does not show up....

                  Or possible I've missed something, as I'd never tried that. Honestly, I've never heard of such problem as yours with the dialogs, and have never experienced something similar myself.

                  Unfortunately, I have nothing further to suggest.

                  Kind regards.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    roseicollis
                    wrote on 19 Feb 2016, 12:44 last edited by roseicollis
                    #37

                    @kshegunov Well.. we have decided to use the dialog and tell the user to press Y or N to exit or not and this issue about the focus will be a future bug to fix... (hope this 'future time' never cames... ) XD

                    Thank you so much for ALL your help and patience ^^ @kshegunov and @SGaist Really grateful :D

                    I'll try to solve the other problems (posted in this forum too) about going back 2 pages and the key buffer issue :)

                    K 1 Reply Last reply 19 Feb 2016, 12:49
                    0
                    • R roseicollis
                      19 Feb 2016, 12:44

                      @kshegunov Well.. we have decided to use the dialog and tell the user to press Y or N to exit or not and this issue about the focus will be a future bug to fix... (hope this 'future time' never cames... ) XD

                      Thank you so much for ALL your help and patience ^^ @kshegunov and @SGaist Really grateful :D

                      I'll try to solve the other problems (posted in this forum too) about going back 2 pages and the key buffer issue :)

                      K Offline
                      K Offline
                      kshegunov
                      Moderators
                      wrote on 19 Feb 2016, 12:49 last edited by
                      #38

                      @roseicollis

                      Well.. we have decided to use the dialog and tell the user to press Y or N to exit or not and this issue about the focus will be a future bug to fix

                      I think this a practical decision.

                      Thank you so much for ALL your help

                      Anytime. Take care!

                      Kind regards.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      0

                      38/38

                      19 Feb 2016, 12:49

                      • Login

                      • Login or register to search.
                      38 out of 38
                      • First post
                        38/38
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved