Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error message always pops up on same tab



  • There are 3 tabs in total and each tab is associated to certain tool buttons.
    Individual tab is supposed to throw a specific UIError.

    Currently error message getting popped up in the last tab as default.

    Requirement is to have the error message pop in that specific tab.
    Any suggestions to resolve this would be of great help.
    Thanks in advance.


  • Lifetime Qt Champion

    Hi,

    Where are these errors coming from ?
    How are they associated with the tabs ?



  • This post is deleted!


  • @Shruthi
    You are throwing an exception, and with a class of UIError. FWIW, that is your own class. In any case, it's a C++ throw, so how do you handle that, because whatever it is that's what displaying your message?



  • In the window called test_window there are three tabs - tab1,tab2,tab3 and one push button called run. For example in tab2 I have checkbox followed by the lineEdit and I am validating the lineEdit field on clicking the pushbutton run. Validation for the lineEdit is user should enter values from 1-10. If not, I am raising an UIError.

    void test_window::on_pushButton_1_clicked()
    {
    validateLineEdit();
    }

    void test_window::validateLineEdit
    {
    throw UIError("Error: LineEdit",
    "The field is not in the expected range.\n" ,
    "please enter the valid value.\n");
    }

    This error should pop in tab2 itself but by default it pops to the last tab i.e., tab3
    How to pass the tab information while throwing the UIError.

    Suggestions are appreciated.
    Thank you.



  • @JonB Yes. It's displaying the message correctly whatever it is. But all the errors pops to the last tab because the pushbutton is not confined to tab. It's for window.
    So, on clicking all the error defaults to last tab. How to make it specific to tab.

    Thank you so much for your reply.



  • @Shruthi
    So I don't know what code you use to display the thrown error. It apparently needs altering to do whatever it is you want to achieve.

    How to pass the tab information while throwing the UIError.

    Like I said, UIError appears to be your own class. If you want to pass the tab, change that class to accept the tab, and use it for the message.


Log in to reply