Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Convert from int to hex
Qt 6.12 LTS is out! See what's new in the release blog

Convert from int to hex

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 28.9k 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

    Hello, i need to convert from int to hex, i find method QByteArray::toHex, but it is dont worke
    @lineEdit_7->setText(QString("%1").arg(QVariant(QByteArray(QVariant(c.red()).toByteArray()).toHex()).toString()));@
    It is get some number(for example 323535), what do i do wrong?
    And how can it be easier to write?
    Advance many thanks for your help!

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

      "Tada.":http://lmgtfy.com/?q=qt+decimal+to+hex

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

        Have a look at "QString::number()":http://doc.qt.nokia.com/4.7/qstring.html#number

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

          @
          lineEdit_7->setText( QString::number( c.red(), 16 ) );
          @

          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
          • Unsolved