Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Update Windows Title in Embedded Application
Forum Update on Monday, May 27th 2025

Update Windows Title in Embedded Application

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 4.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.
  • K Kashif

    Hi All,
    I have developed a simple ticket booking application, set the windows title using "setWindowTitle" method and its working fine. Now I have two methods connected to two push buttons "New Booking" and "Cancel Booking"
    Now I want, when someone press "New Booking" button, the main window title should be updated to "New Booking" and for "Cancel Booking" the same accordingly.
    I tried to use "setWindowTitle" inside "newBooking" method it it is giving me segmentation fault.
    Hope to get help accordingly.

    Thanks

    A Offline
    A Offline
    applqpak
    wrote on last edited by applqpak
    #2

    @Kashif Hello,

    Do you have any code?
    I created a quick test app that calls setWindowTitle() in a slot when a QPushButton is clicked in Qt Creator, everything works fine

    Not clicked:
    alt text
    Title changes when button is clicked:
    alt text

    K 1 Reply Last reply
    0
    • A applqpak

      @Kashif Hello,

      Do you have any code?
      I created a quick test app that calls setWindowTitle() in a slot when a QPushButton is clicked in Qt Creator, everything works fine

      Not clicked:
      alt text
      Title changes when button is clicked:
      alt text

      K Offline
      K Offline
      Kashif
      wrote on last edited by
      #3

      Hi @applqpak,

      Sorry I missed to mention that I am working on embedded device with Linux kernel, using QTopia+widget application.

      Following is code snippet for your reference:

      //main.cpp
      
      #include "gprs_connect.h"
      #include <qtopiaapplication.h>
      
      QTOPIA_ADD_APPLICATION(QTOPIA_TARGET, GPRSConnect)
      QTOPIA_MAIN
      
      
      //gprsConnect.cpp
      GPRSConnect::GPRSConnect(QWidget *parent, Qt::WindowFlags f)
              : QMainWindow(parent, f)
      {
      
          setWindowTitle("Easy Ticket");   //This works fine
      
          centralWidget = new QWidget(this);
          layout = new QVBoxLayout(centralWidget);
          QString label_state;
      
          label_state="Select Your Option";
      
          lblTranName = new QLabel("IDLE MENU", centralWidget);
          layout->addWidget(lblTranName);
      
          lblTranMsgs = new QLabel(label_state, centralWidget);
          layout->addWidget(lblTranMsgs);
      
          layout->addStretch();
      
          purButton = new QPushButton(tr("Purchase"), centralWidget);
          connect(purButton, SIGNAL(clicked(bool)), SLOT(Purchase()));
          layout->addWidget(purButton);
      
          refundButton = new QPushButton(tr("Refund"), centralWidget);
          connect(refundButton, SIGNAL(clicked(bool)), SLOT(refund()));
          layout->addWidget(refundButton);
      
          quitButton = new QPushButton(tr("Quit"), centralWidget);
          connect(quitButton, SIGNAL(clicked(bool)), SLOT(close()));
          layout->addWidget(quitButton);
      
          layout->setMargin(0);
          layout->setSpacing(0);
          setCentralWidget(centralWidget); 
      
      }
      
      
      void GPRSConnect::Purchase()
      {
          QFont fontDef = lblTranMsgs->font();
          QFont fontNew = lblTranMsgs->font();
          fontNew.setBold(true);
          lblTranMsgs->setFont(fontNew);
          lblTranMsgs->update();
          lblTranMsgs->repaint();
      	
          //setWindowTitle("PURCHASE");   //Segmentation Fault
          QWidget::setWindowTitle("PURCHASE");   //Segmentation Fault
      
      }
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Hi,

        Qtopia ? Are you locked to it ? That's a project that has reached EOL 8 years ago so it's not necessarily a good idea to start a new project with it.

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

        K 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          Qtopia ? Are you locked to it ? That's a project that has reached EOL 8 years ago so it's not necessarily a good idea to start a new project with it.

          K Offline
          K Offline
          Kashif
          wrote on last edited by
          #5

          Hi @SGaist,
          Its a new device for me, and I am following the base code provided by the device vendor. I don't know how to change the architecture and if i do something how to make it work on device.
          I tried hello world ui application, compiled successfully but it gives me run time exceptions on device.

          Hope this answers your query.

          Thanks

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            You should check with the vendor if you can use something a bit more recent.

            As for your error, can you get a stack trace ?

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

            K 1 Reply Last reply
            1
            • SGaistS SGaist

              You should check with the vendor if you can use something a bit more recent.

              As for your error, can you get a stack trace ?

              K Offline
              K Offline
              Kashif
              wrote on last edited by Kashif
              #7

              Hi @SGaist,

              Sorry for delayed response as I am woking in Qatar and we have weekend for Friday/Saturday.
              I tried again the same thing and I am not getting exception now, no idea what I had done before, may be some uninitialized pointer that I may have fixed when moving forward to application logical code.
              Currently as I mentioned that I am not getting exception but issue is that the main window title is getting updated when the control is returned back to main constructor. Also to mention that I have disabled the push buttons in the same function and that code is working fine:
              For the main window title I have placed following line of code:

                  setWindowTitle("PURCHASE");
                  centralWidget->update();
                  centralWidget->repaint();
              
              

              Thanks

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                The QMainWindow title has nothing to do with the central widget.

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

                K 1 Reply Last reply
                0
                • SGaistS SGaist

                  The QMainWindow title has nothing to do with the central widget.

                  K Offline
                  K Offline
                  Kashif
                  wrote on last edited by
                  #9

                  Hi @SGaist,
                  Can you please write me a line or reference on how do to update QMainWindow title in my code as I am not using "ui" component so its something unknown for me.

                  Thanks

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Well:
                    @Kashif said in Update Windows Title in Embedded Application:

                    setWindowTitle

                    of your QMainWindow is the right method AFAIR.

                    Can you show what you get ?

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

                    K 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      Well:
                      @Kashif said in Update Windows Title in Embedded Application:

                      setWindowTitle

                      of your QMainWindow is the right method AFAIR.

                      Can you show what you get ?

                      K Offline
                      K Offline
                      Kashif
                      wrote on last edited by Kashif
                      #11

                      Hi @SGaist,

                      I used this function in my code but the title is getting updated only when the control returns back to push button calling event (the class constructor where I have defined central widget and buttons, code is pasted in third comment)

                      Thanks

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        Why are you calling QWidget::setWindowTitle rather than just setWindowTitle ?

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

                        K 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Why are you calling QWidget::setWindowTitle rather than just setWindowTitle ?

                          K Offline
                          K Offline
                          Kashif
                          wrote on last edited by
                          #13

                          Hi @SGaist,

                          I tried both and the outcome is same.

                          Thanks

                          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