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. What does Utf8 means ???
Qt 6.11 is out! See what's new in the release blog

What does Utf8 means ???

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 4 Posters 5.5k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    What does this means @bgWidget->setObjectName(QString::fromUtf8("bgWidget")); @

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      It is used in creating music widget, or something like, for setting the object name.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        You can find it "here":http://doc.qt.nokia.com/4.7/qobject.html#objectName-prop in the doumentation

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Thanks for your reply...

          @QWidget *bgWidget = new QWidget(this);
          bgWidget->setObjectName(QString::fromUtf8("bgWidget"));@

          Can you please tell me why are we using in the above coding

          @QString::fromUtf8("bgWidget"))@

          and also tell me about this fromUtf8...

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            It hard to tell you from this snippet, usually as the documentation says (above link) this is mainly used if you want to find the object later among childwidgets, etc.

            Regarding the fromUtf8 I beleive this also should be described in the documentation, I really do not see why it is required here.

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              thanks for your reply...

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                This means we are creating this widget ,so that we can use it afterwords when we need it ....Is this correct ????

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  [quote author="Prajnaranjan Das" date="1293434549"]Thanks for your reply...

                  @QWidget *bgWidget = new QWidget(this);
                  bgWidget->setObjectName(QString::fromUtf8("bgWidget"));@

                  Can you please tell me why are we using in the above coding
                  [/quote]
                  Line 1 creates the widget. This is a must.

                  Line 2 gives the object a name, this completely optional. It's mainly used in debug output. It is completely different from the variable name, although often both are the same.

                  [quote author="Prajnaranjan Das" date="1293434549"]

                  @QString::fromUtf8("bgWidget"))@

                  and also tell me about this fromUtf8...[/quote]

                  QString internally uses unicode for the strings. Unfortunately the world is not unicode in every place. Source code often contains only 8-bit strings. If your source code is in UTF-8 unicode, then you have to tell QString in order to do the right decoding.

                  If you're not sure about Unicode and UTF-8, just ask a search engine - it is a quite big topic and would be out of scope for the Qt forum. Wikipedia would be a good start too.

                  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