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. QSize to qstring
Qt 6.11 is out! See what's new in the release blog

QSize to qstring

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 2.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.
  • S Offline
    S Offline
    saber
    wrote on last edited by
    #1

    i want to convert qsize to qstring.
    qApp->screens()[1]->size()

    J.HilkJ 1 Reply Last reply
    0
    • S saber

      i want to convert qsize to qstring.
      qApp->screens()[1]->size()

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

      @saber

      QSize s = qApp->screens()[1]->size();
      QString sizeString("(%1,%2)").arg(s.width()).arg(s.height());
      

      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.

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

        @saber

        QSize s = qApp->screens()[1]->size();
        QString sizeString("(%1,%2)").arg(s.width()).arg(s.height());
        
        S Offline
        S Offline
        saber
        wrote on last edited by
        #3

        @J.Hilk thank.
        sorry for silly problem.0_1522070033527_o.png

        JonBJ 1 Reply Last reply
        0
        • S saber

          @J.Hilk thank.
          sorry for silly problem.0_1522070033527_o.png

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #4

          @saber
          I think @J-Hilk meant:

          QString sizeString = QString("(%1,%2)").arg(s.width()).arg(s.height());
          

          (or at least try that instead?)

          Also:

          QString sizeString = QString("(%1,%2)").arg(s.width(), s.height());
          

          may be slightly preferable.

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved