Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. StackView icon on Android
Forum Updated to NodeBB v4.3 + New Features

StackView icon on Android

Scheduled Pinned Locked Moved Solved QML and Qt Quick
18 Posts 5 Posters 2.2k Views 2 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.
  • B Offline
    B Offline
    Bleach
    wrote on last edited by Bleach
    #6

    Thanks guys. On the android device on which the bug is appear, no any font contains the required characters.
    alt text

    I'll have to use the icon, as I wrote @ekkescorner. The main reason why I don't want to do this is that the character approach has already been tested on different platforms and devices. But there seems to be no other way out.

    J.HilkJ 1 Reply Last reply
    0
    • B Bleach

      Thanks guys. On the android device on which the bug is appear, no any font contains the required characters.
      alt text

      I'll have to use the icon, as I wrote @ekkescorner. The main reason why I don't want to do this is that the character approach has already been tested on different platforms and devices. But there seems to be no other way out.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #7

      @Bleach said in StackView icon on Android:

      But there seems to be no other way out.

      you can always ship a font with your application, one that has the characters, and load the font manually via
      QFontDatabase::addApplicationFont QWidget
      or FontLoader component in QML


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      B 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @Bleach said in StackView icon on Android:

        But there seems to be no other way out.

        you can always ship a font with your application, one that has the characters, and load the font manually via
        QFontDatabase::addApplicationFont QWidget
        or FontLoader component in QML

        B Offline
        B Offline
        Bleach
        wrote on last edited by Bleach
        #8

        @J-Hilk Thanks. Which approach do you think would be better?

        J.HilkJ KroMignonK 2 Replies Last reply
        0
        • B Bleach

          @J-Hilk Thanks. Which approach do you think would be better?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #9

          @Bleach They are equivalent, but since you're using QML, I would suggest the FontLoader
          https://doc.qt.io/qt-5/qml-qtquick-fontloader.html#details


          the docs show a website as source, you can just as well pass it an url that points to your resource system, and a ttf file in there


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          2
          • B Bleach

            @J-Hilk Thanks. Which approach do you think would be better?

            KroMignonK Offline
            KroMignonK Offline
            KroMignon
            wrote on last edited by
            #10

            @Bleach said in StackView icon on Android:

            Thanks. Which approach do you think would be better?

            I prefer define myself the used fonts, so I am sure App looks same on every device.
            I do something like this:

            int main(int argc, char *argv[])
            {
                QGuiApplication app(argc, argv);
            
                const QString fontFilename(QStringLiteral("Resources/fonts/GOTHIC.TTF"));
                QString fontFamily(QStringLiteral("Century Gothic"));
                if(QFileInfo::exists(fontFilename))
                {
                     int fontId = QFontDatabase::addApplicationFont(fontFilename);
                     fontFamily = QFontDatabase::applicationFontFamilies(fontId).first();
                     QFontDatabase::addApplicationFont("Resources/fonts/GOTHICB.TTF");
                     QFontDatabase::addApplicationFont("Resources/fonts/GOTHICBI.TTF");
                     QFontDatabase::addApplicationFont("Resources/fonts/GOTHICI.TTF");
                 }
                 // update default font
                 QFont defaultFont = app.font();
                 defaultFont.setFamily(fontFamily);
                 app.setFont(defaultFont);
            
                 ...
                 return app.exec();
            }
            

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            B 1 Reply Last reply
            1
            • KroMignonK KroMignon

              @Bleach said in StackView icon on Android:

              Thanks. Which approach do you think would be better?

              I prefer define myself the used fonts, so I am sure App looks same on every device.
              I do something like this:

              int main(int argc, char *argv[])
              {
                  QGuiApplication app(argc, argv);
              
                  const QString fontFilename(QStringLiteral("Resources/fonts/GOTHIC.TTF"));
                  QString fontFamily(QStringLiteral("Century Gothic"));
                  if(QFileInfo::exists(fontFilename))
                  {
                       int fontId = QFontDatabase::addApplicationFont(fontFilename);
                       fontFamily = QFontDatabase::applicationFontFamilies(fontId).first();
                       QFontDatabase::addApplicationFont("Resources/fonts/GOTHICB.TTF");
                       QFontDatabase::addApplicationFont("Resources/fonts/GOTHICBI.TTF");
                       QFontDatabase::addApplicationFont("Resources/fonts/GOTHICI.TTF");
                   }
                   // update default font
                   QFont defaultFont = app.font();
                   defaultFont.setFamily(fontFamily);
                   app.setFont(defaultFont);
              
                   ...
                   return app.exec();
              }
              
              B Offline
              B Offline
              Bleach
              wrote on last edited by
              #11

              @KroMignon Thanks again. Works great.

              KroMignonK 1 Reply Last reply
              0
              • B Bleach

                @KroMignon Thanks again. Works great.

                KroMignonK Offline
                KroMignonK Offline
                KroMignon
                wrote on last edited by
                #12

                @Bleach your welcome

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                1 Reply Last reply
                1
                • B Offline
                  B Offline
                  Bleach
                  wrote on last edited by Bleach
                  #13

                  I hurried to the conclusion(
                  The font in the program changed, on the desktop and Android 5 everything works fine, but on the device with Android 8 the above-mentioned symbols are still not displayed correctly.
                  alt text
                  Desktop:
                  alt text

                  KroMignonK LorenDBL 2 Replies Last reply
                  0
                  • B Bleach

                    I hurried to the conclusion(
                    The font in the program changed, on the desktop and Android 5 everything works fine, but on the device with Android 8 the above-mentioned symbols are still not displayed correctly.
                    alt text
                    Desktop:
                    alt text

                    KroMignonK Offline
                    KroMignonK Offline
                    KroMignon
                    wrote on last edited by KroMignon
                    #14

                    @Bleach said in StackView icon on Android:

                    I hurried to the conclusion(
                    The font in the program changes, on the desktop and Android 5 everything works fine, but on the device with Android 8 the above-mentioned symbols are still not displayed correctly.

                    too bad :(
                    Do you have checked QFontDatabase::addApplicationFont() return value?
                    -1 is returned in case of error (cf. https://doc.qt.io/qt-5/qfontdatabase.html#addApplicationFont)

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    B 1 Reply Last reply
                    1
                    • KroMignonK KroMignon

                      @Bleach said in StackView icon on Android:

                      I hurried to the conclusion(
                      The font in the program changes, on the desktop and Android 5 everything works fine, but on the device with Android 8 the above-mentioned symbols are still not displayed correctly.

                      too bad :(
                      Do you have checked QFontDatabase::addApplicationFont() return value?
                      -1 is returned in case of error (cf. https://doc.qt.io/qt-5/qfontdatabase.html#addApplicationFont)

                      B Offline
                      B Offline
                      Bleach
                      wrote on last edited by Bleach
                      #15

                      @KroMignon said in StackView icon on Android:

                      Do you have checked QFontDatabase::addApplicationFont() return value?

                      Yes, it return positive value. And besides, the app font has changed to what I added.

                      UPD. Same issue on Android 10 (both case - default font and loaded by myself OpenSans).

                      KroMignonK 1 Reply Last reply
                      0
                      • B Bleach

                        @KroMignon said in StackView icon on Android:

                        Do you have checked QFontDatabase::addApplicationFont() return value?

                        Yes, it return positive value. And besides, the app font has changed to what I added.

                        UPD. Same issue on Android 10 (both case - default font and loaded by myself OpenSans).

                        KroMignonK Offline
                        KroMignonK Offline
                        KroMignon
                        wrote on last edited by
                        #16

                        @Bleach said in StackView icon on Android:

                        Yes, it return positive value. And besides, the app font has changed to what I added.
                        UPD. Same issue on Android 10 (both case - default font and loaded by myself OpenSans).

                        Strange, I can not explain this behavior. Perhaps you should use pictures or try with fontawesome?

                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                        B 1 Reply Last reply
                        1
                        • B Bleach

                          I hurried to the conclusion(
                          The font in the program changed, on the desktop and Android 5 everything works fine, but on the device with Android 8 the above-mentioned symbols are still not displayed correctly.
                          alt text
                          Desktop:
                          alt text

                          LorenDBL Offline
                          LorenDBL Offline
                          LorenDB
                          wrote on last edited by
                          #17

                          @Bleach FWIW, my Android phone (10) displays an appropriate icon for \u2630.

                          1 Reply Last reply
                          1
                          • KroMignonK KroMignon

                            @Bleach said in StackView icon on Android:

                            Yes, it return positive value. And besides, the app font has changed to what I added.
                            UPD. Same issue on Android 10 (both case - default font and loaded by myself OpenSans).

                            Strange, I can not explain this behavior. Perhaps you should use pictures or try with fontawesome?

                            B Offline
                            B Offline
                            Bleach
                            wrote on last edited by Bleach
                            #18

                            @KroMignon said in StackView icon on Android:

                            Perhaps you should use pictures or try with fontawesome?

                            If it doesn't work with fonts, then I'll do it.

                            @LorenDB . Could you please send me your StackView sample apk? Ill try to deploy it on problem devices.

                            I reproduce this bug from Linux host. Prev tests was from Win 10.
                            Now this looks like a problem with the devices OS. But it is very strange that with two at once..

                            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