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] QWidget::setWindowModified: The window title does not contain a '[*]' placeholder
QtWS25 Last Chance

[SOLVED] QWidget::setWindowModified: The window title does not contain a '[*]' placeholder

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 19.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.
  • K Offline
    K Offline
    K.Sejdak
    wrote on last edited by
    #1

    Hi everyone!

    I'm new to Qt and I started learning it from instruction videos in eLearning section. When I got to events I found something strange - the placeholder. I copied the code from this video (I home without mistakes) and compiled it. There was no errors and program executes correctly, but the compiler says "QWidget::setWindowModified: The window title does not contain a '[*]' placeholder". And I don't understand what is wrong. What is exactly a placeholder and where is it used?

    The mistake is here:
    @MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
    {
    QLabel *label = new QLabel(tr("Try to close the window."));
    QVBoxLayout *vertical = new QVBoxLayout(this);
    vertical->addWidget(label, 0, Qt::AlignCenter);

    this->setWindowModified(true);
    this->setWindowTitle(tr("Close Event[*]"));
    }@
    Can anybody help me?

    "My programs never have bugs, they just develop random features."

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You must call

      @
      setWindowTitle(tr("My crazy MainWindow[*]"));
      @

      Important: The window title must contain a "[*]" placeholder. See the API docs on "QWidget property windowModified":http://doc.qt.nokia.com/4.7/qwidget.html#windowModified-prop for further details.

      Edit
      This is not an error, but a warning. It is not generated during compilation but during run-time, as the C++ compiler cannot know the value of the windowTitle property. This is only set at runtime.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • K Offline
        K Offline
        K.Sejdak
        wrote on last edited by
        #3

        Firstly, thanks for response.

        I know that it's just a warning. But what makes me sad is the fact that I did everything correctly. And I call this function in line 8 of onclosed code and it even has this '[*]' thing. So there shouldn't be any warning. Of course I can live with that, but when someone executes it from a console, this warning is visible and tells that something is not ok. I would like to eliminate it somehow.

        If I am wrong somewhere, please correct me :)

        "My programs never have bugs, they just develop random features."

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          You must set the window title before you call setWindowModified() - just swap the two lines :-)

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • K Offline
            K Offline
            K.Sejdak
            wrote on last edited by
            #5

            Oh... oh... Thanks a lot! I wasted 2h on that :P I was thinking about it, but in that video it was shown just as in the first post.

            "My programs never have bugs, they just develop random features."

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Do you have a link to that video and maybe some timestamp (minute/second) where that appears?

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • K Offline
                K Offline
                K.Sejdak
                wrote on last edited by
                #7

                "Here is the video":http://qt.nokia.com/developer/learning/online/training/modules/fundamentals-of-qt-objects-in-qt-part-3-3
                The mentioned part of code is shown around 5:55 at the top of the screen.

                "My programs never have bugs, they just develop random features."

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  Indeed. Maybe you should leave some feedback (there is a link in the text below the video player). At least they can add some hint on that page, so that other users do not get bitten by this too.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kamalakshantv
                    wrote on last edited by
                    #9

                    [quote author="eclipse" date="1291413438"]"Here is the video":http://qt.nokia.com/developer/learning/online/training/modules/fundamentals-of-qt-objects-in-qt-part-3-3
                    The mentioned part of code is shown around 5:55 at the top of the screen.[/quote]

                    Thanks for the video link

                    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